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

2E "unless the element is marked as presentational" is unclear #108

Open
JAWS-test opened this issue Feb 7, 2021 · 8 comments · May be fixed by w3c/aria#2405
Open

2E "unless the element is marked as presentational" is unclear #108

JAWS-test opened this issue Feb 7, 2021 · 8 comments · May be fixed by w3c/aria#2405
Milestone

Comments

@JAWS-test
Copy link

JAWS-test commented Feb 7, 2021

Otherwise, if the current node's native markup provides an attribute (e.g. title) or element (e.g. HTML label) that defines a text alternative, return that alternative in the form of a flat string as defined by the host language, unless the element is marked as presentational (role="presentation" or role="none").

In my opinion, the following problems arise here:

  • there is no statement what is with implicit role=presentation (example 3, 4).
  • there is no statement whether the role=presentation must be at the current node or at the "element that defines a text alternative" for the exception to apply (example 2. 3)
  • there is no statement what happens if the element has role=presentation but the role=presentation itself is ignored because of the many exceptions (example 1)

This is problematic because this is currently interpreted differently by browsers and AccName Prototype Test (see the examples)

@MelSumner
Copy link
Contributor

@JAWS-test do you think these issues are a side effect of invalid code, or did the implementors genuinely not understand the spec?

@JAWS-test
Copy link
Author

@MelSumner Neither nor. If the specification is unclear, every browser does what it thinks. The specification should be clear, then the browsers know how to do it right.

@MelSumner MelSumner changed the title 2D "unless the element is marked as presentational" is unclear 2E "unless the element is marked as presentational" is unclear Apr 30, 2021
@MelSumner
Copy link
Contributor

Updated the title due to the re-ordering in #122

@giacomo-petri
Copy link

+1

This issue is an older one, but I believe it still needs to be addressed.

The behavior in these cases is unclear:

<label role="presentation" for="test">First Name</label>
<input id="test" type="text">
<label role="presentation">
    <span>First Name</span>
    <input type="text">
</label>

I would expect the accessible name to remain "First Name" in both scenarios, but the specifications are not clear on this.

The current wording, particularly the phrase "unless the element is marked...", is ambiguous. It is unclear whether this refers to the "current node" or to the "element (e.g., an HTML label or SVG title)".

To resolve the ambiguity, changing it to "unless the current node is marked..." would provide clarity.

There is still one issue to address regarding the Presentational Roles Conflict Resolution. Even if role="presentation" is applied to the <input>, its accessible name will still be computed according to the original specifications. It might be useful to add a note about this behavior.

I’m opening a tentative PR to address these points.

@accdc
Copy link
Contributor

accdc commented Dec 23, 2024

I think we need to talk about this in the WG meeting. I'm not convinced this is an AccName specific issue since the application of the presentational role doesn't just impact the name but also the role, and any focusable element has its presentational state ignored.

@scottaohara
Copy link
Member

FWIW i agree with @giacomo-petri's assumption that even if a label is given a role=none, it would be used to name an input in those scenarios. A label doesn't have a role that's exposed to the a11y tree - so marking it as presentational won't even do anything in the a11y tree.

similarly, i'd also expect (which matches reality) that the name of this fieldset is "foo" <fieldset><legend role=none>foo</legend>...</fieldset> - suppressing/changing the element's role shouldn't undo the other mappings or functionality the element has in HTML - in this case, naming the parent fieldset.

@MelSumner
Copy link
Contributor

It's strange behavior to have so many exceptions just because developers make so many mistakes.

What is the point of having the role of presentation or none if it only works sometimes?

We're twisting ourselves into pretzels to accommodate code that is simply invalid. We need a better solution than this.

@scottaohara
Copy link
Member

scottaohara commented Jan 11, 2025

@MelSumner i don't see this as adding exceptions. there are differences in behavior here, as i mentioned by jaws test, and further called out in the back and forth i was having with Giacomo in his PR for this issue. so it's not unreasonable to to get this clarified, since there isn't full interop.

i don't disagree that some of this could be considered invalid code from the authoring side - but the ARIA spec is clear that unless a host language explicitly states that certain features are not to be overwritten by ARIA, or ARIA doesn't have other stipulations written, then ARIA takes precedent.

additionally, this isn't about making role=none not work (its purpose is to remove role semantics - that's not changing with this discussion or PR). But changing the role of an element in HTML (to any role, not just role=none) does not mean its implicit behaviors / functionality also change. So a label or legend should still provide a name to their associated input or fieldset, respectively. role=none can negate the role semantics of those elements (well, if label even had one to negate that is...) but the other behaviors/functionality of HTML should not be impacted by the role change - hence they should still name the elements they are associated with, since that's their native HTML behavior.

but if role none is put on the "current node", as is one interpretation of the spec text (which i think is probably the right one) - THEN the role=none kicks in and the element shouldn't be named, because it can't be, it no longer has a role that allows it to be named. so role=none working as it should. no twisting.

TBH, where there is a problem here, it's not even unique to role=none. but putting any role on a label will break it naming an input in Firefox (but not chrome or webkit).

with that said, i think @giacomo-petri has done a good job at trying to address this issue. i had some confusion about what the expected outcome should be due to the wpt that was initially made, but after clearing that up, it looks like this was on the right track and it'll make things more consistent / keep things accessible even if authors do something weird, once this has been finalized.

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

Successfully merging a pull request may close this issue.

6 participants