-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
search-widget(aria-live) status for results found #77031
Conversation
- We would like to notify the user about the results we found the screen reader will read out the number of results or no result aria-live is added at load, as it cannot be added adhoc
@@ -372,7 +372,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas | |||
} else { | |||
label = NLS_NO_RESULTS; | |||
} | |||
this._matchesCount.appendChild(document.createTextNode(label)); | |||
let myAlert = document.createElement('div'); |
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.
Why do we need to introduce a div
element? Can you please explain that.
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.
Also if we decide this this is need myAlert
should be a const
not a let
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.
Why do we need to introduce a
div
element? Can you please explain that.
- aria-live - seems to need a change, beyond just a text update. Without the DIV, the reading of aria-live is not consistent
- I investigated to review the accessibility tree - for clues as to why, but it does not seem that there is anyway to access the
*. chrome://accessibility/
**. accessibility tab - in the Element inspector is not available
I will try to install this tool - to review it for any clues
https://electronjs.org/docs/tutorial/accessibility#devtron
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.
the extra div element - is needed, since normal text changes to the DOM are not enough
https://github.com/microsoft/vscode/blob/master/src/vs/base/browser/ui/aria/aria.ts#L58
@@ -807,6 +809,10 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas | |||
|
|||
this._matchesCount = document.createElement('div'); | |||
this._matchesCount.className = 'matchesCount'; | |||
|
|||
this._matchesCount.setAttribute('role', 'alert'); |
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.
role
: alert
and aria-live: assertive
should be equivalelnt based on the W3 spec
Does it still work if we use only one of these?
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.
correct, works with either
@georgebatalinski thank you very much for you PR. @rebornix can you please take this over, since from tommorow I am on a 15 day vacation. I just did an initial review. |
@rebornix let me know your thoughts |
@isidorn @rebornix after doing some research - it seems we have a way to add an populate Solutions:
|
@georgebatalinski thanks for your help on this. I played with the code change and it works as expected. Regarding the two solutions you proposed, I found that option #2 actually works the same as I'll suggest to simply use |
In addition to that, to make the alert more descriptive, we can probably alert Test cases I run manually: Text Document
Above information can be found by reading @georgebatalinski let me know if you need me to make some updates directly ;) |
@@ -807,6 +809,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas | |||
|
|||
this._matchesCount = document.createElement('div'); | |||
this._matchesCount.className = 'matchesCount'; | |||
|
|||
this._matchesCount.setAttribute('aria-live', 'assertive'); |
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.
If we use aria.alert
, then this is no longer necessary, right?
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.
yes
- We use alert from aria base
@rebornix let me know if it works on your side as expected (It does on mine :) |
LGTM. thanks! |
@georgebatalinski @rebornix Great work! Thanks a lot! |
the screen reader will read out the number of results or no result
aria-live is added at load, as it cannot be added adhoc
Proposal for Issue - #69741