Skip to content
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

Merged
merged 7 commits into from
Jan 10, 2020
Merged

Conversation

isidorn
Copy link
Contributor

@isidorn isidorn commented Dec 30, 2019

This PR:

  • Adds the setAria api to the Editor, that gets passed to the textAreaHandler
  • Adopts the setAria api in the Suggest widget. This way the suggest widget no longer uses the aria.alert
  • Refactors how aria labels are set for CompletionItems and the details. Overall things should be simpler now in the SuggestWidget

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.

@isidorn isidorn added this to the January 2020 milestone Dec 30, 2019
@isidorn isidorn self-assigned this Dec 30, 2019
@@ -162,6 +165,7 @@ class Renderer implements IListRenderer<CompletionItem, ISuggestionTemplateData>
const data = <ISuggestionTemplateData>templateData;
const suggestion = (<CompletionItem>element).completion;

data.root.id = getAriaId(_index);
Copy link
Member

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...)

Copy link
Contributor Author

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(
Copy link
Member

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...

Copy link
Contributor Author

@isidorn isidorn Dec 31, 2019

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looking better now

@zersiax
Copy link

zersiax commented Jan 3, 2020

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?

@isidorn
Copy link
Contributor Author

isidorn commented Jan 3, 2020

@zersiax correct. If everything goes well this should hit insiders some time next week, most probably Tuesday or Wednesday. Thanks a lot!

Copy link
Member

@alexdima alexdima left a 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.
*/
Copy link
Member

@alexdima alexdima Jan 10, 2020

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) {
Copy link
Member

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;
Copy link
Member

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?

@isidorn isidorn merged commit 2ee7ddb into master Jan 10, 2020
@isidorn isidorn deleted the isidorn/aria-suggest branch January 10, 2020 15:04
@isidorn
Copy link
Contributor Author

isidorn commented Jan 10, 2020

Thanks a lot for the review.
@zersiax you can try it out with vscode insiders from next Monday. Thanks!

@zersiax
Copy link

zersiax commented Jan 10, 2020

@isidorn confirmed, will let you know monday or tuesday ;)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete accessibility glitch
4 participants