[EuiSelectable] Add a mixed state to EuiSelectableListItem that renders a new icon and SR-only text#6774
[EuiSelectable] Add a mixed state to EuiSelectableListItem that renders a new icon and SR-only text#67741Copenut merged 22 commits intoelastic:mainfrom 1Copenut:feature/euiSelectableListItem-mixed-option
EuiSelectableListItem that renders a new icon and SR-only text#6774Conversation
|
I need to add the documentation updates and finish testing across browsers. Will do that before EOD today and hopefully move this out of draft. |
|
jenkins test this |
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
src/components/selectable/selectable_list/__snapshots__/selectable_list_item.test.tsx.snap
Outdated
Show resolved
Hide resolved
src/components/search_bar/filters/field_value_selection_filter.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6774/ |
ryankeairns
left a comment
There was a problem hiding this comment.
LGTM
Small suggestion - we could add a button to reset the example. Its just as easy to reload the page, but might be nice as a reader clicks on items, checking states, and trying to understand the point... as I just did :)
Co-authored-by: Cee Chen <549407+cee-chen@users.noreply.github.com>
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
src/components/selectable/selectable_list/selectable_list_item.tsx
Outdated
Show resolved
Hide resolved
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6774/ |
| <EuiI18n | ||
| token="euiSelectableListItem.includedOption" | ||
| default="Checked option." | ||
| /> |
There was a problem hiding this comment.
| <EuiI18n | |
| token="euiSelectableListItem.includedOption" | |
| default="Checked option." | |
| /> | |
| <EuiI18n | |
| token="euiSelectableListItem.checkedOption" | |
| default="Checked option." | |
| /> |
Since we're making the string the exact same as line 224 down below we should just go ahead and make these the same i18n token/string. Our i18n translators skip having to re-translate the same string that way.
There was a problem hiding this comment.
Actually, we're repeating a bunch of i18n strings across the board down below. I'd prefer to dry those out into const's I think... any objections if I push up a clean up?
There was a problem hiding this comment.
I refactored this in 7ee93d4 and found several bugs/missing or confusing SR text that was fixed as a result of cleaning up the branches (namely, mixed and non allowExclusions options did not have the correct SR text).
I think this should be fixed now - @1Copenut, do you want to do a final pass on all EuiSelectable
The permutations that generate different screen reader text that need to be tested:
+ `aria-disabled` and `aria-checked` is valid - do not return undefined if disabled + `aria-checked` mixed is invalid for certain roles - return false if so
- add describe block tests for `role` and `aria-checked` - add describe blocks for `checked` - switch to RTL render
- DRY out repeated i18n tokens/strings - Make branching easier to follow (hopefully...) - Fix some incorrect branching logic leading to missing SR text (namely non-exclusion mixed) - Improve SR reading by using a period instead of a hyphen (at least for FF+VO) - Add more unit tests to snapshot branching output + rename various vars to be slightly clearer
- Remove `allowExclusions` from example - while they work together, it's unlikely consumers will use both, and we should focus on just mixed options for this demo to isolate concerns - Document when consumers would want to use this state - Add button that allows resetting mixed state display - Fix snippet
cee-chen
left a comment
There was a problem hiding this comment.
This LGTM at this point from a code & docs POV, but the screen reader text may need more robust testing. Feel free to tweak the branching if you find any issues with it!
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6774/ |
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_6774/ |
|
I passed through the recommended states using four screen reader combinations:
All performed as expected with no regression that I could tell from previously coded version. Moving this to close after merging. |
## Summary `@elastic/eui@80.0.0` ⏩ `@elastic/eui@81.0.0` --- ## [`81.0.0`](https://github.com/elastic/eui/tree/v81.0.0) - Added ability to set `options.checked` to "mixed" in `EuiSelectable` ([#6774](elastic/eui#6774)) **Bug fixes** - Portalled components (e.g. `EuiPopover`, `EuiModal`, `EuiFlyout`) will correctly inherit text color from its nearest `EuiThemeProvider` parent. `<EuiText color="default">` is no longer needed. ([#6775](elastic/eui#6775)) **Breaking changes** - `EuiSelectable` no longer renders a `data-test-selected` attribute on its list items. Use the `aria-checked` property instead ([#6774](elastic/eui#6774)) - Nested `EuiThemeProvider`s now render a wrapping `<span>` element in order to correctly set the inherited text `color` of all descendants. `<EuiText color="default">` is no longer needed. ([#6775](elastic/eui#6775)) --------- Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Constance Chen <constance.chen@elastic.co>
Summary
EUI team was requested to add a "mixed" state to the
EuiSelectablecomponent so teams could communicate a "selected for some" status for theoptionsobject passed into the component. This mixed state is not selectable by users, but can be updated to checked, excluded, or unchecked entirely.I left three granular commits in the history instead of squashing, so reviewers can follow along (if so inclined) to see how I arrived at this solution. I took a long look at the MDN guidance for aria-checked to inform the screen reader text.
This PR closes #6771.
QA
Remove or strikethrough items that do not apply to your PR.
General checklist
@defaultif default values are missing) and playground toggles