-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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(multiselect): replace checkbox with visually identical element #5039
fix(multiselect): replace checkbox with visually identical element #5039
Conversation
Deploy preview for the-carbon-components ready! Built with commit e429737 https://deploy-preview-5039--the-carbon-components.netlify.com |
Deploy preview for carbon-elements ready! Built with commit e429737 |
Deploy preview for carbon-components-react failed. Built with commit e429737 https://app.netlify.com/sites/carbon-components-react/deploys/5e2b35c673e6ab000a865434 |
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.
Hey @tw15egan! 👋 We were actually taking a look at this today in the morning 👀 When looking at the DAP violation, it seemed like instead we need to remove our usage of checkbox and instead provide something that visually is identical but without the underlying checkbox <input>
Deque has a demo with their custom multiselect icon over in: https://dequelabs.github.io/combobo/demo/ that we were referencing.
The whole reason a checkbox itself isn't necessary is that aria-selected
will indicate whether an item is selected for a screen reader user and the visual representation of the selection will be enough for the keyboard user as they don't need tab stops created from the checkboxes.
@joshblack updated to use a new element instead of a |
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.
Did a pass with VoiceOver and NVDA on Windows 10 and macOS. Controls work as expected and reads quite well everywhere but Firefox, but it seems like that's an existing bug that no ones noticed yet unrelated to this PR in particular. 🤦♂
DAP errors gone -- that's awesome. If we decided to remove role=group
as well I can recheck real quick.
d0cb73d
to
41355a5
Compare
Alright made some modifications as I went through it with voiceover on my mac. Still not sure how to alert that an option has been selected/checked. DAP errors should still be resolved |
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.
quick run through with NVDA on Windows 10 in Chrome and Edge and it looks like in Chrome I can no longer access the options menu and in Edge I can, but there is no focus or indication
Would that be due to adding the |
lemme check VO real quick |
It's working with VoiceOver in Safari and Chrome, but now the option menu is no longer working on Windows 10 in Chrome 😕 In Edge it works, but there's no indications or where in the menu you are (focus states) -- you can just see the menu scrolling as the options are read. Something in the last round of changes. |
CC @carmacleod just in case she has some insights on using native checkbox for multi select dropdown's selection. |
A quick test of DAP and Windows Chrome/FF/CrEdge with NVDA/JAWS, and Mac Safari with VO, on the checkbox list in Example 2 on this page seems ok. Of course, that's just a very quick test. Checkboxes in the example are native, with opacity 0 and svg image. I realize that the example listbox is not in a dropdown, but hopefully that won't change things? Make sure you use css visibility: hidden on the dropdown to completely hide it when it isn't showing (i.e. don't use html hidden or css display: none because the animation may not be smooth, and don't use opacity 0 on the dropdown or position it offscreen because that doesn't really hide it from keyboard or screen readers). Note when using the new Chromium-based-Edge with screen readers, it helps a lot to turn off UIA. Hope this is helpful! |
a97aab1
to
eccb976
Compare
d539c4a
to
ba9c1cf
Compare
@carmacleod Thank you for your insights! @tw15egan Does the guidance from @carmacleod make sense? Thanks! |
We specifically hit the fieldset violation from DAP when using checkboxes which is what the removal of native checkboxes is for. The specific rule that is flagged is: https://aat.w3ibm.mybluemix.net/token/1899dd76-e350-4eef-aaea-8d7f41a398f6/807c38b0-4c39-41db-9d71-72230dbc0eb5/archives/2019SeptDeploy//doc/w3/help/en-US/idhi_accessibility_check_g1029.html Ultimately, in a listbox we do not require native checkboxes to indicate selection status as this is done through
|
fieldset?! Wild. DAP shouldn't be flagging that for checkboxes in a listbox or table.
Yep - that is a totally fine solution, too! :) |
@carmacleod Ok, awesome! Good to know this is a valid solution as well. @joshblack added in @dakahn Let me know what further voiceover work we want to include in this PR, or if we should open a sperate issue for that. |
Make sure you have |
510b567
to
806d162
Compare
4636064
to
5691507
Compare
@joshblack @dakahn Any further comments? Update 1/24/2020: Pinged them offline. |
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.
Looks great! 🎉
Closes #4008
After reading Josh's comment, this replaces the use of a checkbox entirely and uses a visually identical element to visually indicate change.
Changelog
Changed
Checkbox
inside ofMultiSelect
and uses an element that toggles the checkbox styles based onisChecked
Testing / Reviewing
Open the
MultiSelect
component, expand theMultiSelect
, then run DAP and ensure there are no longer any violations. There will be 1 violation due to the nature of the Storybook.Also, ensure new element styles match old styles