-
Notifications
You must be signed in to change notification settings - Fork 29.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
Suggest widget set aria active descendent #87880
Conversation
@@ -162,6 +165,7 @@ class Renderer implements IListRenderer<CompletionItem, ISuggestionTemplateData> | |||
const data = <ISuggestionTemplateData>templateData; | |||
const suggestion = (<CompletionItem>element).completion; | |||
|
|||
data.root.id = getAriaId(_index); |
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.
no more underscore for _index? (now that it is used...)
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.
Updated, thanks.
getAriaLabel: (item: CompletionItem) => { | ||
if (this.expandDocsSettingFromStorage()) { | ||
const { documentation, detail } = item.completion; | ||
const docs = strings.format( |
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.
This is tricky... Usually, detail and documentation aren't defined and the UI triggers that when an item gains focus. I don't think tho that this call is sync'd on that and what you get is likely indeterministic. You should be able to call resolve
on the item but you need to know how long you can "wait" for its result...
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, I missed this.
However this is just working since once the suggestion details and docs get resolved the item will get re-rendered by the splice
call here.
When the item gets rerendered the list asks again for the aria label and we will return deterministicly the correct aria label since the item just got resolved.
I can not wait in the getAriaLabel
call since it is not async.
Idealy the method would also check if the item is resolved, if not just return the label
. However not sure how to check that.
I am open for suggestions.
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.
Yeah, would just be nicer if we wouldn't read it twice. To know if its resolved, you can add a boolean to the CompletionItem
which knows that resolving is done.
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.
As you suggested I have added a isResolved
boolean to the CompletionItem
. So when we compute the aria label if the item is not resolved we will only read the label
.
Let me know what you think.
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.
Yeah, looking better now
Once this hits Insiders', I can give you test results for NVDA on WIndows. You only tested with VoiceOver on OS X so far, correct? |
@zersiax correct. If everything goes well this should hit insiders some time next week, most probably Tuesday or Wednesday. Thanks a lot! |
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, thank you!!
Just a few small things I left comments for.
@@ -319,6 +319,13 @@ export interface IOverviewRuler { | |||
setLayout(position: OverviewRulerPosition): void; | |||
} | |||
|
|||
/** | |||
* Editor aria options. | |||
*/ |
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.
Please add @internal
also here so this unused interface disappears from monaco.d.ts
@@ -424,6 +425,18 @@ export class TextAreaHandler extends ViewPart { | |||
return this._lastRenderPosition; | |||
} | |||
|
|||
public setAria(options: IEditorAriaOptions): void { | |||
if (options.activeDescendent) { |
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 DOM spelling appears to be activedescendant
vs activeDescendent
. Not sure which one is correct, probably the DOM one, so we should use activeDescendant
(with an a
)
* Sets the editor aria options, primarily the active descendent. | ||
* @internal | ||
*/ | ||
setAria(options: IEditorAriaOptions): void; |
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.
I'm not a huge fain of the name setAria
, it feels "unfinished", maybe setAriaOptions
would be better?
Thanks a lot for the review. |
@isidorn confirmed, will let you know monday or tuesday ;) |
This PR:
setAria
api to the Editor, that gets passed to thetextAreaHandler
setAria
api in the Suggest widget. This way the suggest widget no longer uses thearia.alert
CompletionItems
and thedetails
. Overall things should be simpler now in theSuggestWidget
Fixes #3787
Please note that I have tested this on my macOS Catalina and it works just fine. I plan to test it on windows when I am get back to the office next week.
@alexdima let me know what you think
fyi @zersiax @jrieken
We can still fine tune what is exactly being read and if there are still issues.