-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Block Toolbar: Screen readers do not correctly read descriptions of focused elements #65888
Comments
@talksina, If there are any other issues I've missed, I'd be grateful if you could add them. @joedolson @afercia, I can't test on MacOS, so I'd appreciate it if you could test if this issue occurs with VoiceOver as well. |
After investigating using @WordPress/gutenberg-components Do you have any good ideas to solve this? I suspect something about this code might be affecting it. |
I also noticed that even outside of the block toolbar, buttons with tooltips changed what my screen reader announced when they received focus. For example, if I focus on the "Toggle block inserter", "Tools", "Undo", "Redo", "Document overview" buttons in the post editor header in that order, my screen reader reads them as follows: Before #64066
After #64066
In addition to the |
I haven't look too much in details, but the code that you highlighted seems to be doing the right thing — ie. adding a Also, for additonal context, this change on our side was necessary because arikit stopped adding the cc @DaniGuardiola who worked on this change, and @diegohaz in case he can spot anything missing from our patch which could cause this change in what the screen reader announces. |
That's correct @ciampo, and I think we more or less agreed to remove it but patch it to keep the impact of the upgrade relatively small. I think we could take a similar route to what we did with button sizes and introduce a |
Thank you for your feedback. However, it is true that there is an issue with screen readers not reading element labels and descriptions correctly, at least with NVDA. For example, I added the following story about the Detailsexport const MultipleIcons = () => {
return (
<>
<Button
icon={ formatBold }
label="Bold"
description="Bold icon description"
/>
<Button
icon={ formatItalic }
label="Italic"
description="Italic icon description"
/>
<Button
icon={ link }
label="Link"
description="Link icon description"
/>
</>
);
}; When I use the tab key to focus through the buttons, I hear:
Video recording of the test: actual.mp4I can see that the description, i.e. the Before #64066, it was read out as follows, which I believe is the correct reading:
Video recording of the test: expected.mp4I would appreciate it if you could confirm if this issue occurs with VoiceOver as well. |
with JAWS it's the same.
I would expect it to read command, description and keyboard shortcut -
maybe description and keyboard shortcut should appear in the control's
"title" attribute?
I'm not a coder unfortunately but what I know is that before Gutenberg 19.2
the issue wasn't there.
Elena Brescacin - Accessibility, WordPress, HIV awareness
E-Mail: ***@***.***
MOBILE: +39 328 7483161
LINK: ***@***.*** <https://linktr.ee/ilmondopositivo>
Il giorno sab 5 ott 2024 alle 16:38 Aki Hamano ***@***.***>
ha scritto:
… Thank you for your feedback.
However, it is true that there is an issue with screen readers not reading
element labels and descriptions correctly, at least with NVDA.
For example, I added the following story about the Button component:
Details
export const MultipleIcons = () => {
return (
<>
<Button
icon={ formatBold }
label="Bold"
description="Bold icon description"
/>
<Button
icon={ formatItalic }
label="Italic"
description="Italic icon description"
/>
<Button
icon={ link }
label="Link"
description="Link icon description"
/>
</>
);};
When I use the tab key to focus through the buttons, I hear:
(Focus the Bold button)
Bold button
(Focus the Italic button)
Bold icon description
Italic button
(Focus the Link button)
Italic icon description
Link button
Video recording of the test:
https://github.com/user-attachments/assets/e47492c7-7e4e-47e7-ac94-82ec8e7cd192
I can see that the description, i.e. the aria-describedby text, is not
being read out correctly.
Before #64066 <#64066>, it was
read out as follows, which I believe is the correct reading:
(Focus the Bold button)
Bold button Bold icon description
(Focus the Italic button)
Italic button Italic icon description
(Focus the Link button)
Link button Link icon description
Video recording of the test:
https://github.com/user-attachments/assets/793f650c-4f8b-4786-9ae5-2fe13e4ee1de
I would appreciate it if you could confirm if this issue occurs with
VoiceOver as well.
—
Reply to this email directly, view it on GitHub
<#65888 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADT5KDURNPZA4PX3WSUTTO3ZZ72VTAVCNFSM6AAAAABPM6ZHJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJVGA3TSMJVHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Confirmed this is also happening on VoiceOver. I looked at what's happening, and the The tooltip is usually the accessible name of the control; as such, it should be in the |
@joedolson that could be a way to improve the patch while we figure out how to transition away from it. |
The important thing to note is that this issue also occurs in WP 6.7. |
How can I test |
@diegohaz You can use the Playground to test WP 6.7 Beta1: https://playground.wordpress.net/?php=8.0&wp=beta |
Thanks! I still can't get VoiceOver/Safari 17.2 to announce the description of the previously focused button. However, there's a flash of text on the caption panel just before I move the focus, which might refer to the previous description, but I'm not sure. I can reproduce the issue using NVDA, though. I suspect it's caused by dynamically changing the I suggest not relying on tooltips for labels or descriptions, especially since Gutenberg removes tooltips from the DOM when they're not displayed. Treat them as purely visual elements. Labels and descriptions should be rendered statically in the DOM (using the |
What do you think about making the following changes to prevent the In other words, only when the child does not have the diff --git a/packages/components/src/tooltip/index.tsx b/packages/components/src/tooltip/index.tsx
index 7ce9311fc9..1b61062180 100644
--- a/packages/components/src/tooltip/index.tsx
+++ b/packages/components/src/tooltip/index.tsx
@@ -109,7 +109,10 @@ function UnforwardedTooltip(
// the tooltip anchor anymore since 0.4.0, so we need to add it manually.
// See: https://github.com/WordPress/gutenberg/pull/64066
function addDescribedById( element: React.ReactElement ) {
- return describedById && mounted
+ return describedById &&
+ mounted &&
+ element.props[ 'aria-describedby' ] === undefined &&
+ element.props[ 'aria-label' ] !== text
? cloneElement( element, { 'aria-describedby': describedById } )
: element;
} |
That may work, although this could be the right moment to move away from relying on tooltips to add meaningful descriptive text:
Given all of the above, I wonder if, instead of tweaking the |
Related: #61168 (comment) |
I totally agree. Tooltips in Gutenberg have been originally implemented only to visually expose the accessible name (the aria-label) of icon buttons. Usin them for descriptions or other information is far from ideal. This was reported in other issues as well but still, there are occurrences in the editor where tooltips are used for instructions, descriptions and such. All those cases should be audited.
The previous ariakit implementation was less than ideal and I'm glad it has been changed upstream. Re-implementing it in the editor is less than ideal as well and dismisses the recommendation made from accessibility specialists in this project. Can you point me please to the change that patched the implementation in the editor? From a design, usability, UI, perspective, placing essential information in a tooltip is less than ideal in the first place. Some users may have not accesso the the tooltip referenced by aria-describedby. Announcement of description may also be disabled in the screen readers user preferences. Also, the
Yes please. This should be documented in the components and in the design guidelines: tooltips must not be used for descriptions. Thanks. |
For context, the only reason we added the patch was to keep the impact of the Ariakit upgrade work as minimal as possible, but we were aligned on removing the behavior down the line, to align with the Ariakit change. We didn't give it any further thought and we also didn't see a problem with the patch back then, it seemed to correctly mimic the previous Ariakit behavior but it's possible that we missed some nuance in the implementation. I'm glad this came up because it's a sign that we should probably do the work to remove the patch and handle accessible labels in all impacted usages of Tooltip. I see two paths:
I think the single PR is probably fine, as it's not a big change and it can save us a lot of iteration and review time. Any mistakes can be fixed afterwards with small PRs. What do y'all think? |
I' dlike to have a look at the reasoning and process there, thanks, |
I think either path makes sense, but I think this needs to be fixed in the WP 6.7 cycle. Also, do we need a dev note? I mean, something like "Don't include important text in the tooltip text because screen readers will no longer read it." |
We can start making all the changes in one PR, and decide whether we want to extract them to several PRs before merging.
@afercia this is the PR. As mentioned by Dani, the rationale for applying the patch on our end was to minimize the amount of changes to test / introduce at once with that ariakit update, since there were many already. To reiterate, we are all aligned in removing this behavior from |
Thanks @ciampo. My point is more about process. I don't see that PR marked with the accessibility label even though it touched an important accessibility issue and the original ariakit behavior was already reported as problematic. I'm not sure that PR was only about technical implementation and for better collaboration in this project I'd like to see accessibility specialists involved in the discussion of important accessibility issues. Thanks, |
Got it. Since we decided to add that patch to keep things unchanged, we didn't think there was a need for the accessibility label. Basically, we updated a bunch of stuff and the tooltip's behaviour was untouched. We would have definitely tagged any issues/PRs touching that aspect of |
I'm not sure why but it appears there is a change somewhere as the double announcement (accessible name + accessible description) of the toolbar buttons wasn't happening with the previous ariakit version and before #64066 The behavior changed somewhere ant this is actually a regression, I'm going to label this issue accordingly. |
@diegohaz you may want to clone the Gutenberg plugin repo in the WordPress At that point, both the accessible name and the accessible description have the same text and both get announced, with default screen reader user preferences (some screen readers allow to disable the announcement of descriptions). Screenshots: |
Is there anything I can do to move this forward? Sorry, I may not yet have the full picture of what tasks should be handled. |
Potentially the quickest, short term change could be to add a check in After that, the long term fix would be to remove the code adding the |
@afercia I put together a tentative short-term improvement, following @t-hamano 's earlier suggestion: Could you give it a quick check? Hopefully it's acceptable as a short-term fix for the 6.7 release. And then we can immediately start working on a long-term fix (ie. remove the |
Update:
|
Thanks for all the work that went into discussing this and finding a good solution. As #65989 is now going to be in WordPress 6.7 I will remove this Issue from the board. The long term effort can continue during the 6.8 cycle. |
Description
Issues discovered in this comment: #61168 (comment)
For example, NVDA reads the element's label, role, and description when an element is focused. However, for focusable elements in the block toolbar, it does speak the description of the previously focused element, and in my testing, it appears to speak the focused element's label twice.
Users who use screen readers will be very confused because the read-out label and description do not match.
According to this comment, it seems that this issue first appeared in Gutenberg 19.2. Also, since this issue also occurs in WordPress 6.7 Beta1, it is necessary to identify the commit that caused the problem and fix it within the 6.7 cycle.
Step-by-step reproduction instructions
Below are the test steps when using Windows OS and NVDA.
WordPress 6.6.2
Everything is read correctly. In my testing, the screen reader basically reads out the label, role and description of the focused element.
Shift+Tab
to focus the block switcher button in the block toolbar. the screen reader should read:WordPres 6.7 Beta1 or Gutenberg 19.4.0-rc.1
All of these are incorrect. In my testing, screen readers read a description of the previously focused element, the label of the focused element, the role of the focused element and the label of the focused element.
Shift+Tab
to focus the block switcher button in the block toolbar. the screen reader should read:Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: