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

Aria-selected is not narrated for the gridcell #11986

Closed
kolaps33 opened this issue Jan 5, 2021 · 20 comments
Closed

Aria-selected is not narrated for the gridcell #11986

kolaps33 opened this issue Jan 5, 2021 · 20 comments
Assignees
Labels
app/chrome app/edge/anaheim MS browser, chromium based, replaces Spartan in 2019 by Anaheim. NVDA access via IA2. app/firefox ARIA p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@kolaps33
Copy link

kolaps33 commented Jan 5, 2021

Steps to reproduce:

  1. Navigate to the example: https://codesandbox.io/s/pqrni?module=/example.js
  2. Navigate into "Select a date. edit"
  3. Open date picker and choose any day different from today (day is selected and picker closed)
  4. Open date picker again and navigated to the day which you selected in the previous step
  5. observe narration

Actual behavior:

For example, when 20th of January was selected narration was:
"January 20, 2021 row 5"

Expected behavior:

it narrates "selected" state as well
Expecting this narration, because:

Snippet of HTML of element which is focused:
<button role="gridcell" aria-selected="true" data-aa-class="DatepickerCalendarCellButton" class="ui-datepicker__calendarcellbutton il iz ja bg bh jb jc jd je iu ip iv ir jf jg jh ji is as bp bq br bs bt bu bv bw bx by bz ca gs gt gu gv cf cg ch ci cj ck cl cm cn co cp cq cr cs ct cu cv gw gx gy gz da db dc dd de df dg dh di dj jn jm iw ix" aria-label="January 20, 2021" tabindex="0">20</button>

System configuration

NVDA installed

NVDA version: 2020.3

Windows version:

10.0.19042

Name and version of other software in use when reproducing the issue:

Chrome Version 87.0.4280.88 (Official Build) (64-bit)

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

no haven't

If addons are disabled, is your problem still occuring?

no addons enabled

Did you try to run the COM registry fixing tool in NVDA menu / tools?

no

@msftedad
Copy link

Hi Team, is there any update on this bug?

@Adriani90
Copy link
Collaborator

cc: @SaschaCowley

@SaschaCowley
Copy link
Member

SaschaCowley commented May 1, 2024

This is because of bugs in Firefox and Chromium.

  • Firefox: Firefox assumes the focus is also the selection, even though the spec says "If any DOM element in the widget is explicitly marked as selected, the user agent MUST NOT convey implicit selection for the widget." @jcsteh are you aware of this issue/are there plans to fix it?
  • Chromium: Chromium doesn't expose State.SELECTABLE on any but the selected gridcell, so, while it doesn't eroniously link the focus and selection, it doesn't give NVDA the context necessary to report that the other dates are not selected.

@SaschaCowley SaschaCowley added app/chrome app/firefox app/edge/anaheim MS browser, chromium based, replaces Spartan in 2019 by Anaheim. NVDA access via IA2. labels May 1, 2024
@jcsteh
Copy link
Contributor

jcsteh commented May 1, 2024

* **Firefox**: Firefox assumes the focus is also the selection, even though [the spec](https://www.w3.org/TR/wai-aria-1.2/#state_prop_def) says "If any DOM element in the widget is explicitly marked as selected, the user agent MUST NOT convey implicit selection for the widget." @jcsteh are you aware of this issue/are there plans to fix it?

I wasn't aware of this; thanks.

  1. Isn't this a different bug to the one described here, though? That would cause "selected" to be reported when it shouldn't, rather than "selected" not being reported when it should.
  2. The spec has actually changed since then. Browsers now shouldn't calculate an implicit selected state for gridcells at all:

    The option, tab, and treeitem roles permit user agents to provide an implicit value for aria-selected when specified conditions are met. User agents MUST NOT provide an implicit value for aria-selected in any other circumstance.

@jcsteh
Copy link
Contributor

jcsteh commented May 1, 2024

I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1894436 for gridcell.

I also filed https://bugzilla.mozilla.org/show_bug.cgi?id=1894437 for option, tab and treeitem. However, I see that Chromium has the same bug and I honestly wonder whether the spec needs to be changed here because supporting that rule is almost certainly going to cause hideous performance problems in some cases.

@jcsteh
Copy link
Contributor

jcsteh commented May 1, 2024

I see the selected state isn't being reported for the selected date in Firefox when it's focused, but I'm struggling to understand why. Even if Firefox is incorrectly exposing the selected state when it shouldn't in some cases, why should that prevent the selected state from being reported? It's... very confusing.

@SaschaCowley
Copy link
Member

I think this is because NVDA doesn't report "selected" for the selected item in single-select controls. Though honestly I find NVDA's reporting of "selected" and "not selected" to be irregular and confusing.

@jcsteh
Copy link
Contributor

jcsteh commented May 1, 2024

The fact that it incorrectly reports "selected" when you move to a (not selected) date would suggest otherwise. Also, this isn't based on single or multi select controls; it's based on the role. If I'm reading the code correctly, selected should get reported for all selectable table cells unconditionally.

@jcsteh
Copy link
Contributor

jcsteh commented May 1, 2024

Ah, this is deliberate and based on the selected item count. If only 1 item is selected, the selected state isn't reported.
https://github.com/nvaccess/nvda/blob/bf96860d561aa6c1e03f0cbd286be9b04587cb92/source/speech/speech.py#LL636
b02ed2d. This was done to prevent "selected" from being reported for every cell in Google Sheets; see #8879.

@SaschaCowley
Copy link
Member

The fact that it incorrectly reports "selected" when you move to a (not selected) date would suggest otherwise.

...

Ah, this is deliberate and based on the selected item count. If only 1 item is selected, the selected state isn't reported.

Yup, so because Firefox is reporting the focused item as selected, if there is a cell with aria-selected=true, and it is not the focused cell, the selection count is 2 and we hear "selected". So reporting of the actually selected date is working correctly, but reporting of non-selected dates is not.

@SaschaCowley
Copy link
Member

We could try working around this in NVDA by checking if any selection widgets contain an explicit selection, and if so removing the selected state from any children without aria-selected set, but this will potentially be quite expensive, depending on implementation specifics that I'm not sure of off the top of my head.

@jcsteh
Copy link
Contributor

jcsteh commented May 1, 2024

We'll fix the Firefox bug. But my point is that this won't solve the reporter's original request:

Expected behavior:
it narrates "selected" state as well

It explicitly won't say selected because the selection count will now be 1 instead of 2. So we'd be fixing a bug, yes, but it would be a different issue to the one that's reported here. The issue reported here, as I understand it, is intended behaviour (not reporting "selected").

@SaschaCowley
Copy link
Member

I interpreted 'it narrates "selected" state as well' to mean that the selection state is accurately reported, not necessarily that "selected" is spoken. We closed a (somewhat) similar issue (#16449) yesterday as expected behaviour.

If your interpretation is correct, I personally think that a new issue should be created, as the problem applies to more than just ARIA gridcells.

@jcsteh
Copy link
Contributor

jcsteh commented May 1, 2024

I'll leave that call up to you. For what it's worth, I've submitted a patch to fix the Firefox gridcell issue.

@jcsteh
Copy link
Contributor

jcsteh commented May 8, 2024

The Firefox gridcell bug has been fixed in Firefox Nightly and the fix will be included in the Firefox 127 release.

@alexstine
Copy link

Anyone think maybe the aria-selected="true" could also be effected in this multiselect example?

https://dequelabs.github.io/combobo/demo/

When aria-selected="false" is set, it is not initially announced until it is toggled on and then back off. I can open another issue if not but it is reproducible in both Chrome and Firefox.

@Adriani90
Copy link
Collaborator

In Firefox this now seems to be reported properly. Not selected dates are reported as "not selected" and the selected date is reported without any selection atribute which is clear enough that a selection has been performed.
In Chromium canary 133, neither of both selected or not selected is reported.
I filled
https://issues.chromium.org/issues/380411642

@alexstine could you please open a new issue with your behavior, explaining exactly what happens? When do you exactly set aria selected? I suspect this happens after you press enter or when you click on an item. Before that no aria selected is set at all so NVDA cannot report anything.

@alexstine
Copy link

@Adriani90 You are correct. Before a selection is made with the enter key, aria-selected attribute is not present in the option div nodes. That is most likely the issue here, I'll see if I can reach out to the maintainer to fix this example. I assume this may work, needs testing, if the aria-selected="false" attribute is set initially.

@Adriani90
Copy link
Collaborator

Result on the chromium bug, it seems it is an NVDA issue. NVDA reports the selected value only when using ctrl+alt+arrow keys in browse mode.
But it doesn't report the selected / unselected items in the date picker when using arrow keys in focus mode.

cc: @SaschaCowley the Chromium issue has been closed since it is NVDA specific.

Note that in Firefox, NVDA announces the currently selected item withut atribute, and the unselected items as "unselected" when using arrow keys in focus mode. This is expected behavior in Chrome as well.

Is Chrome not exposing the right things here?

@gerald-hartig gerald-hartig added blocked/needs-external-fix triaged Has been triaged, issue is waiting for implementation. and removed blocked/needs-external-fix triaged Has been triaged, issue is waiting for implementation. labels Jan 20, 2025
@SaschaCowley SaschaCowley self-assigned this Jan 20, 2025
@gerald-hartig gerald-hartig added p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation. labels Jan 20, 2025
@SaschaCowley
Copy link
Member

As @jcsteh has pointed out, this is due to incorrect authoring. All selectable gridcells have to have aria-selected set in ARIA 1.3. Closing as invalid.

@github-actions github-actions bot added this to the 2025.1 milestone Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app/chrome app/edge/anaheim MS browser, chromium based, replaces Spartan in 2019 by Anaheim. NVDA access via IA2. app/firefox ARIA p5 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
Development

No branches or pull requests

7 participants