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

[EuiSelectable] Fix incorrect aria-posinset indices #6571

Merged
merged 5 commits into from
Feb 2, 2023

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Feb 1, 2023

Summary

closes #6565

This bug was occurring whenever group labels existed in the options array that were not located at the start of the array.

QA

General checklist

  • Revert [REVERT ME] commit
  • Added or updated jest and cypress tests
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

- I'm doing this because I'll need RTL's `rerender` props setting in the future, which Enzyme's `render` does not support
- this new logic correctly accounts for group labels not at the start of the options array

+ perf bonus - this array iteration now only happens once per rerender, as opposed to happening on every single item/option render

- could likely be further optimized to only rerun when `visibleOptions` or `options` change, but I think this incremental improvement is fine for now
@cee-chen cee-chen marked this pull request as ready for review February 1, 2023 20:00
@cee-chen
Copy link
Contributor Author

cee-chen commented Feb 1, 2023

@1Copenut Once staging is up, do you mind giving this a quick screen reader pass to make sure everything's working correctly when you have a quick sec? 🙇

@cee-chen cee-chen requested a review from 1Copenut February 1, 2023 20:00
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6571/

1 similar comment
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6571/

@cee-chen cee-chen requested a review from Heenawter February 1, 2023 20:25
@cee-chen
Copy link
Contributor Author

cee-chen commented Feb 1, 2023

I've been making Trevor do a lot of reviews lately, so CCing @Heenawter as well in case she wants to help QA/confirm the fix 😄

Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Did a quick review of the code and double checked that the the aria-posinset property of each item in the https://eui.elastic.co/pr_6571/#/forms/selectable#the-basics example was set correctly - everything seems correct to me! Thanks so much for tackling this so quickly 🎉

Copy link
Contributor

@1Copenut 1Copenut left a comment

Choose a reason for hiding this comment

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

👍 This passes an axe check on Chrome latest (MacOS). I tested VoiceOver using Safari and Firefox. Safari is handling the counts correctly as outlined in the MDN aria-setsize documentation.

VO + Firefox does some unexpected (to me) counting, but that behavior was observed on production too, so not a regression. It's entirely possible VO + Firefox users are used to this behavior and consider it correct; I don't have enough information to flag it as a separate improvement item.

@cee-chen
Copy link
Contributor Author

cee-chen commented Feb 2, 2023

Huzzah!! Thanks for the thorough testing y'all! 🏆

@cee-chen cee-chen enabled auto-merge (squash) February 2, 2023 00:58
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6571/

@cee-chen cee-chen merged commit f97cd0c into elastic:main Feb 2, 2023
@cee-chen cee-chen deleted the aria-posinset branch February 2, 2023 01:33
cee-chen added a commit to elastic/kibana that referenced this pull request Feb 9, 2023
## Summary

`[email protected]` ⏩ `[email protected]`

___

## [`74.0.2`](https://github.com/elastic/eui/tree/v74.0.2)

**Bug fixes**

- Fixed `EuiCard` to ensure `onClick` method only runs once when `title`
contains a React node
([#6551](elastic/eui#6551))
- Fixed `EuiSelectable` options with incorrect `aria-posinset` indices
when rendered with group labels not at the start of the array
([#6571](elastic/eui#6571))
- Fixed a bug with `EuiSearchBar` where filters with `multiSelect:
false` were not able to select a new option when an option was already
selected ([#6577](elastic/eui#6577))

Co-authored-by: Kibana Machine <[email protected]>
1Copenut added a commit to elastic/kibana that referenced this pull request Feb 14, 2023
## Summary

`[email protected]` ⏩ `[email protected]`

___

## [`75.0.0`](https://github.com/elastic/eui/tree/v75.0.0)

- `EuiFlyout`s now automatically shard all fixed `EuiHeader`s on the
page. This means that interactions (mouse & keyboard) with items inside
`EuiHeader`s when flyouts are open will no longer trigger focus fighting
([#6566](elastic/eui#6566))
- `EuiFlyout`s now read out detailed screen reader dialog instructions
and hints on open ([#6566](elastic/eui#6566))

**Bug fixes**

- Fixed `EuiSelectable` options with incorrect `aria-posinset` indices
when rendered with group labels not at the start of the array
([#6571](elastic/eui#6571))
- Fixed a bug with `EuiSearchBar` where filters with `multiSelect:
false` were not able to select a new option when an option was already
selected ([#6577](elastic/eui#6577))

**Breaking changes**

- Removed the ability to customize the `role` prop of `EuiFlyout`s.
`EuiFlyout`s should always be dialog roles for screen reader
consistency. ([#6566](elastic/eui#6566))
- Removed `closeButtonAriaLabel` prop from `EuiFlyout` - use
`closeButtonProps['aria-label']` instead
([#6566](elastic/eui#6566))

---------

Co-authored-by: Kibana Machine <[email protected]>
justinkambic pushed a commit to justinkambic/kibana that referenced this pull request Feb 23, 2023
## Summary

`[email protected]` ⏩ `[email protected]`

___

## [`75.0.0`](https://github.com/elastic/eui/tree/v75.0.0)

- `EuiFlyout`s now automatically shard all fixed `EuiHeader`s on the
page. This means that interactions (mouse & keyboard) with items inside
`EuiHeader`s when flyouts are open will no longer trigger focus fighting
([elastic#6566](elastic/eui#6566))
- `EuiFlyout`s now read out detailed screen reader dialog instructions
and hints on open ([elastic#6566](elastic/eui#6566))

**Bug fixes**

- Fixed `EuiSelectable` options with incorrect `aria-posinset` indices
when rendered with group labels not at the start of the array
([elastic#6571](elastic/eui#6571))
- Fixed a bug with `EuiSearchBar` where filters with `multiSelect:
false` were not able to select a new option when an option was already
selected ([elastic#6577](elastic/eui#6577))

**Breaking changes**

- Removed the ability to customize the `role` prop of `EuiFlyout`s.
`EuiFlyout`s should always be dialog roles for screen reader
consistency. ([elastic#6566](elastic/eui#6566))
- Removed `closeButtonAriaLabel` prop from `EuiFlyout` - use
`closeButtonProps['aria-label']` instead
([elastic#6566](elastic/eui#6566))

---------

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EuiSelectable] aria-posinset value wrong when there is a group label
4 participants