-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(material/dialog): dialog content not being read out by screen readers #14533
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
fix(material/dialog): dialog content not being read out by screen readers #14533
Conversation
src/lib/dialog/dialog-config.ts
Outdated
/** Whether the dialog should focus the first focusable element on open. */ | ||
autoFocus?: boolean = true; | ||
autoFocus?: boolean = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jelbourn these changes are based on our discussion from a while back. An alternate approach we can take is to move focus to the first focusable element immediately, rather than assigning it to the dialog container in between. This allows the screen reader to read out a bit more, but still not everything (it reads out the dialog header and buttons, but it skips the content vs the behavior in master where only the button is read out).
I opted for this approach, because it allows for all the content to be read out, even though it's not the recommended one.
b8d9d85
to
9e9c39c
Compare
Which screenreaders did you test this in? |
I've been testing it with NVDA. |
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
2 similar comments
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
9e9c39c
to
110a8ea
Compare
110a8ea
to
b582aea
Compare
7de991e
to
4534cd8
Compare
4534cd8
to
5f5be59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What's the status on this PR? |
It looks like this change breaks a large number of targets in Google and needs some scheduled time to land |
…ders Currently we focus the first focusable element inside a dialog as per the accessibility recommendations, however moving focus to the first item causes some screen readers not to read out the rest of the dialog content. These changes switch to focusing the dialog container by default which allows screen readers to read out everything. If users press tab, they'll land on the first tabbable element anyways. The old behavior can still be opted into via the `autoFocus` option. Fixes angular#10591.
5f5be59
to
8546297
Compare
I've been experiencing this issue in the application I'm working on, which led me to diving deeper into it. Based on my research, I don't think that the proposed fix is the best way forward. Please have a look at the example of accessible dialog here, which has autofocusing functionality as well. I've tested it with NVDA. The screen reader announces both, the title and the description while having the first focusable element autofocused. This is due to the fact that the element with attribute I've attempted to apply this fix in my app, but I'm still not getting the title or description read out. I believe this is due to the fact that focus is assigned to the dialog container first and then immediately assigned to the first focusable element. Instead, it needs to be assigned to the first focusable element immediately. This is a running theory - not something I have confirmed. However, given the working example of a dialog above, I think we should be able to fix material dialog to read out all content while keeping the default value of |
This fix was superseded by #23085. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Currently we focus the first focusable element inside a dialog as per the accessibility recommendations, however moving focus to the first item causes some screen readers not to read out the rest of the dialog content. These changes switch to focusing the dialog container by default which allows screen readers to read out everything. If users press tab, they'll land on the first tabbable element anyways. The old behavior can still be opted into via the
autoFocus
option.Fixes #10591.