Ensure that labels explicitly set on divs and spans are reported in braille and speech#8886
Conversation
…divs and spans (that don't usually get reported) are shown in browseMode in both speech and braille.
|
@michaelDCurran I've been browsing with this change for a few days, and the extra verbosity is annoying. In places like GitHub, the div's label is either a substring of the actual contents, or both are equal. I'm not sure if adding a special case to not announce the label when it is the same as its contents would be justified, since that is nonstandard, but the way it is being used in the wild is problematic. |
|
I've also seen these cases on Github. I guess this is an improper use of
aria-label where the label is used as a description.
|
|
Can you give a specific example?
I will probably revert this anyway, as after talking with some others,
setting aria-label on a div or span with no specific aria-role is
apparently against the spec anyway.
This change will only encourage bad behavior.
|
|
|
GitHub use aria-label for tool tip messages, which is totally inappropriate (and I'd argue it's a spec violation). Still, the fact remains that this is happening on major sites in the wild. Another case where this change is problematic is where a div/span has no useful content, in which case we fall back to the name as the content. In that case, you get duplication. Consider this example:
With this change, you'll hear "foo foo". If we keep this, we really should detect this case and prevent the duplication. |
…ted in braille and speech" (#8899) * Revert "Revert "Don't announce 'selected' when the focus moves in Google sheets if the focused cell is the only cell selected (#8879)" (#8893)" This reverts commit b4e9e83. * Revert "Don't announce 'selected' when the focus moves in Google sheets if the focused cell is the only cell selected (#8879)" This reverts commit 51f5b2f. * Revert "Merge all vbufBackend dlls into nvdaHelperRemote.dll (#8866)" This reverts commit 24f5123. * Revert "Fix handling of table cells without a containing table in browse mode. (#8887)" This reverts commit 5fe34c5. * Revert "Ensure that labels explicitly set on divs and spans are reported in braille and speech (#8886)" This reverts commit fd24d81.
|
I have reverted this pr: |
Link to issue number:
None.
Summary of the issue:
A web author can explicitly set the label of a node using aria-label or aria-labelledby. In BrowseMode, NvDA will in some cases use this label as the actual text content, and in some cases report it as extra meta information. However, in the case of a div or a span that is not presented in any other way, NVDA currently fails to report the label at all. It should at least be reported as meta info. As the web author rightfully expects that if they set a label, it will be exposed somewhere.
The following html fragment in Firefox demonstrates this:
NVDA does not announce "span label" or "div label" anywhere.
Description of how this pull request fixes the issue:
In both speech and braille, NVDA now reports the label (name) if explisitly set by the author (alwaysReportName). Note that in the case of landmarks where the label is already reported specifically as the landmark label, care is taken not to duplicate the label for both speech and braille.
Testing performed:
In Firefox, read the above testcase in both speech and braille. "span label" was reported before "span text" and "div label" before "div text".
Known issues with pull request:
None.
Change log entry:
In BrowseMode, NVDA will now always report labels on divs and spans explicitly set by the web author.