Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Accessibility] Nested ARIA and HTML buttons - Presentational Roles Conflict Resolution #50045

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

giacomo-petri
Copy link
Contributor

@giacomo-petri giacomo-petri commented Jan 13, 2025

Closes: web-platform-tests/interop-accessibility#161

Relates: w3c/aria#1174

Description:
This WPT is designed to evaluate how browsers expose ARIA (non-focusable) vs HTML (focusable) buttons and assess their consistency.

Note:
I’ve set the expectation for the ARIA button nesting a non-focusable ARIA button to "generic" because, as of now (pending resolution of w3c/aria#1174), the ARIA specification states that button children are presentational. This means it does not trigger Presentational Roles Conflict Resolution. However, WebKit, Chromium, and Gecko currently ignore this specification.

wai-aria/role/role_none_conflict_resolution.tentative.html Outdated Show resolved Hide resolved
wai-aria/role/role_none_conflict_resolution.tentative.html Outdated Show resolved Hide resolved
wai-aria/role/role_none_conflict_resolution.tentative.html Outdated Show resolved Hide resolved
Comment on lines 34 to 38
//https://github.com/web-platform-tests/interop-accessibility/issues/161 starts
const innerButton = document.createElement("button");
innerButton.textContent = " (inner button)";
innerButton.id = "inner-button";
document.getElementById("inner-button-container").appendChild(innerButton);
Copy link
Contributor

@cookiecrook cookiecrook Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to change [an attr] a change of the same element, or would testing the before/after states of separate elements be sufficient?

Copy link
Contributor Author

@giacomo-petri giacomo-petri Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure I understand the question. However, if I'm interpreting it correctly, the issue arises because browsers automatically adjust nested buttons by moving the inner button outside the parent button.

To address this, I'm using JavaScript to dynamically inject a button inside another button.
Therefore, the final state of a button nested into another button will suffice.

Copy link
Contributor

@cookiecrook cookiecrook Jan 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, you've moved the ARIAUtils.verify…() calls after this DOM modification, which is another way to address the concern I alluded to but insufficiently explained... No further modification is necessary. Thanks. Okay to mark this thread as resolved.

wai-aria/role/role_none_conflict_resolution.tentative.html Outdated Show resolved Hide resolved
wai-aria/role/role_none_conflict_resolution.tentative.html Outdated Show resolved Hide resolved
wai-aria/role/role_none_conflict_resolution.tentative.html Outdated Show resolved Hide resolved
innerButton.classList.add("ex");
innerButton.setAttribute('data-expectedrole','button');
innerButton.setAttribute('data-testname','JS injected HTML button within another HTML button');
document.getElementById("inner-button-container").appendChild(innerButton);
Copy link
Contributor

@cookiecrook cookiecrook Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this test may not return anything useful, since button > span > button is invalid (I think?) and not guaranteed to render anything as it's own inner button. If it doesn't get a RenderObject, there won't be a reliable way to check the role.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was curious to see the result because button > span > button isn’t allowed in HTML; in fact, as expected, browsers automatically move the nested button outside the parent button.
However, if you wrap the button using JavaScript, the nested buttons remain and "work as intended".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay then... Since this is undefined behavior, the only remaining change needed is to remove the expectation that this should be a button... After further WG discussion, we may decide that's right, or it may end up being something else, so I don't want a tentative test (with a potentially invalid assumption) to be the cause of an rendering engine change that needs to be rolled back later.

innerButton.setAttribute('data-expectedrole','SPEC_AMBIGUOUS_LOG_VALUE');

I'm marking the PR as approved, pending this last change. Thanks for your diligence and patience!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Contributor

@cookiecrook cookiecrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending one more change.

innerButton.classList.add("ex");
innerButton.setAttribute('data-expectedrole','button');
innerButton.setAttribute('data-testname','JS injected HTML button within another HTML button');
document.getElementById("inner-button-container").appendChild(innerButton);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay then... Since this is undefined behavior, the only remaining change needed is to remove the expectation that this should be a button... After further WG discussion, we may decide that's right, or it may end up being something else, so I don't want a tentative test (with a potentially invalid assumption) to be the cause of an rendering engine change that needs to be rolled back later.

innerButton.setAttribute('data-expectedrole','SPEC_AMBIGUOUS_LOG_VALUE');

I'm marking the PR as approved, pending this last change. Thanks for your diligence and patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accessibility: children presentational true element nesting another control injected via JavaScript
3 participants