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

Substantially improve accessibility of Dropdown component #5385

Merged
merged 10 commits into from
Jul 3, 2018

Conversation

cliffkoh
Copy link
Contributor

@cliffkoh cliffkoh commented Jun 29, 2018

Pull request checklist

Description of changes

Substantially improves Dropdown accessibility, particularly for single select dropdown. Multi-select dropdown could still use some more polish, but is improved quite substantially as well with this change.

Also fixed various code issues and loose typings (e.g. the options props for Dropdown was of any type this entire time!!! we were calling super() in constructor twice!!!! We were mutating props!!! etc.)

dropdown

Microsoft Reviewers: Open in CodeFlow





Copy link
Contributor

Choose a reason for hiding this comment

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

spacing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh weird..

selectedIndices = this._getSelectedIndexes(props.options, selectedKey!);
}

if (!props.multiSelect) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could this be combined with the above else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes :)

@betrue-final-final
Copy link
Member

Alright so there are some problems. As soon as I get to the page it keeps repeating "Select an Option, 1of 5, non-selected,"
Also the order of text is backwards when you start arrowing down to options. It currently says
"5 of 7, non-selected, Option e"
When it should say
"Option e, 5 of 7, non-selected, "

@cliffkoh
Copy link
Contributor Author

cliffkoh commented Jun 29, 2018

@betrue-final-final assuming you are talking about my branch but look at my screen capture above, it isn't what you described...

It in fact says the right thing.

@betrue-final-final
Copy link
Member

I'll send you my Narrator buddy output as soon as I get back to my computer.

@cliffkoh
Copy link
Contributor Author

I don't know what to do if I cannot repro it though. Could you point to somewhere in the implementation that I should tweak?

@betrue-final-final
Copy link
Member

I just had a thought. I realize that the bug where it starts announcing the dropdowns without them being in focus I was in scan mode. I'm not totally sure how you would change the order of the text...

@betrue-final-final
Copy link
Member

betrue-final-final commented Jun 29, 2018

My Narrator buddy output:

Starting Narrator Buddy
Starting Narrator
Office UI Fabric React Examples and 22 more pages - Microsoft Edge window, Microsoft Edge, custom,
Scan
Select an Option, 1 of 5, non-selected,
Select an Option, 1 of 10, non-selected,
Select an Option, 1 of 7, non-selected,
Select an Option, 1 of 10, non-selected,
Office UI Fabric React Examples, Test Coverage. Good, link,
value http://localhost:4322/#/components-status, read-only,
Edit Dropdown Overview on GitHub, link,
Tooltip, https://github.com/OfficeDev/office-ui-fabric-react/edit/master/packages/office-ui-fabric-react/src/components/Dropdown/docs/DropdownOverview.md.
Select an Option, 1 of 10, non-selected,
Select an Option, 1 of 7, non-selected,
Select an Option, 1 of 10, non-selected,
Select an Option, 1 of 5, non-selected,
Select an Option, 1 of 10, non-selected,
Select an Option, 1 of 10, non-selected,
Select an Option, 1 of 5, non-selected,
Select an Option, 1 of 10, non-selected,
Select an Option, 1 of 10, non-selected,
Select an Option, 1 of 5, non-selected,
Select an Option, 1 of 7, non-selected,
value https://github.com/OfficeDev/office-ui-fabric-react/edit/master/packages/office-ui-fabric-react/src/components/Dropdown/docs/DropdownOverview.md, read-only,
Edit Dropdown Dos on GitHub, link,
Edit Dropdown Don'ts on GitHub, link,
Show code, button,
Option a, 1 of 10, selected,
Basic uncontrolled example:, Option a, 1 of 10, selected,
Set focus, button,
Option a, 1 of 7, selected,
Controlled example:, Option a, 1 of 7, selected,
Multi-Select uncontrolled example:
Controlled example:, Option a selected, selection contains 7 items,
Option a, 1 of 7, selected,
2 of 7, non-selected, Option b
3 of 7, non-selected, Option c
4 of 7, non-selected, Option d
5 of 7, non-selected, Option e
Exiting Narrator

@betrue-final-final
Copy link
Member

Ok, now the order seems correct, but I'm still getting unprompted dropdown output without focus.

@cliffkoh
Copy link
Contributor Author

cliffkoh commented Jul 3, 2018

Hi @betrue-final-final, I believe I have fixed the issue where all options are read out. I also tested this with cases where a specific option is pre-selected the moment the page load. In all of these cases, we no longer read the options.

Thanks for testing and reporting this behavior.

/**
* Options for the dropdown.
*/
options: IDropdownOption[];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Technically a breaking change since the API surface changed, but on the other hand, this is more akin to type tightening (fixing bugs in our type declaration so that they're better and catch more issues) and the way you fundamentally would expect the API surface to perform has not changed.

Just like as in the case with the Typescript compiler, our present position is that we do not consider these as major-version-only changes.

Copy link
Member

@betrue-final-final betrue-final-final left a comment

Choose a reason for hiding this comment

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

This sounded great! Nice work Cliff.

@betrue-final-final betrue-final-final merged commit 98b5219 into microsoft:master Jul 3, 2018
@cliffkoh cliffkoh deleted the cliffkoh/dropdown branch July 3, 2018 15:23
@cliffkoh cliffkoh mentioned this pull request Jul 5, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dropdown accessibility issues
3 participants