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

[EuiBasicTable] Fix duplicate ID in EuiBasicTable's Select All checkbox(es) #5237

Merged
merged 2 commits into from
Oct 4, 2021

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented Oct 4, 2021

Summary

Bug fix/follow up to #5196 (comment)

  • I hadn't realized during my initial testing that two select all checkboxes are rendered - one in the mobile table header, and one in the regular/desktop table header 🤦‍♀️

  • In our latest Kibana upgrade (Bumping EUI to 39.0.0 kibana#113633), its functional accessibility tests are correctly flagging/raising an error due to both checkboxes sharing the same/duplicate ID

  • The fix here is to generate a separate suffixed ID depending on whether it's a mobile or desktop checkbox

QA

  • Go to https://eui.elastic.co/pr_5237/#/tabular-content/tables#adding-selection-to-a-table
  • Inspect the Select All checkbox in the table header and confirm the ID ends with a _desktop
  • Confirm that checking it does not cause the ID to rerender
  • Make your screen smaller until the table collapses to become mobile
  • Inspect the mobile Select All checkbox and confirm the ID ends with a _mobile
  • Confirm that checking it does not cause the ID to rerender
oV8Ge12oLE.mp4

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes

  • Checked in mobile

- [ ] Checked in Chrome, Safari, Edge, and Firefox
- [ ] Props have proper autodocs and playground toggles
- [ ] Added documentation
- [ ] Checked Code Sandbox works for any docs examples
- [ ] Added or updated jest tests
- [ ] Checked for breaking changes and labeled appropriately

  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

- the Select All checkbox is shown in both the mobile and regular table header, so it was creating an a11y duplicate ID error
@cee-chen
Copy link
Member Author

cee-chen commented Oct 4, 2021

NB: Our EUI a11y tests would have caught this issue, but unfortunately they're currently disabled for basic and in-memory table. I gave myself a timeboxed hour or so to try and fix them alongside this PR, but there's too many other failures on the page - I'll have to consult with Trevor on those and open a separate PR later.

@kibanamachine
Copy link

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

@cee-chen cee-chen changed the title [EuiBasicTable] Fix Select All checkbox in EuiBasicTable duplicate ID [EuiBasicTable] Fix duplicate ID in EuiBasicTable's Select All checkbox(es) Oct 4, 2021
Copy link
Contributor

@breehall breehall left a comment

Choose a reason for hiding this comment

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

This looks good to me!

@cee-chen cee-chen merged commit 4212ba6 into elastic:master Oct 4, 2021
@cee-chen cee-chen deleted the basictable-checkbox-id branch October 4, 2021 23:00
cee-chen added a commit to cee-chen/eui that referenced this pull request Oct 4, 2021
- missing labels on checkbox elements, duplicate checkbox ID (solved in elastic#5237)

- These are all a11y solutions that come OOTB in EuiBasicTable, but need to be added for the custom example
cee-chen added a commit to cee-chen/eui that referenced this pull request Oct 4, 2021
- missing labels on checkbox elements, duplicate checkbox ID (solved in elastic#5237)

- These are all a11y solutions that come OOTB in EuiBasicTable, but need to be added for the custom example
cee-chen added a commit to cee-chen/eui that referenced this pull request Oct 4, 2021
- missing labels on checkbox elements, duplicate checkbox ID (solved in elastic#5237)

- These are all a11y solutions that come OOTB in EuiBasicTable, but need to be added for the custom example
cee-chen added a commit to cee-chen/eui that referenced this pull request Oct 5, 2021
- missing labels on checkbox elements, duplicate checkbox ID (solved in elastic#5237)

- These are all a11y solutions that come OOTB in EuiBasicTable, but need to be added for the custom example
cee-chen pushed a commit that referenced this pull request Oct 5, 2021
…ors on EuiBasicTable and EuiInMemoryTable pages (#5241)

* Fix duplicate checkbox `id`s with multiple isSelectable EuiBasicTables on the page

- This is possibly only an issue with our docs and the fact that we use the same dataset repeatedly across multiple examples, but solves the error of duplicated IDs and shouldn't negatively affect production users

* Fix duplicate popover `id`s with multiple EuiInMemoryTable filters on the page

- there's no real need for this popover to have a custom ID instead of a randomized one - remove it

- This is possibly only an issue with our docs and the fact that we use the same dataset repeatedly across examples, but solves the error of duplicated IDs and shouldn't negatively affect production users

* Fix missing `aria-label` on table pagination

- An `aria-label` was being passed to the `PaginationBar` component, but it wasn't actually being correctly used:
  - `PaginationBar` was never passing an `aria-label` prop down to `EuiTablePagination` or `EuiPagination`
  - The i18n typing was passing a react element instead of a string via render prop

* Fix multiple `landmark-unique` issues on EuiBasicTable & EuiInMemoryTable docs

- While we added an aria-label for each table's paginatoin nav, they still need to be unique for multiple tables on the page, which means adding a tableCaption for each demo

* Fix `scope-attr-valid` errors on empty table column headings

- empty `td`s within a `thead` is valid per https://webaim.org/techniques/tables/data's examples, but should not have the `scope` attr set

* Improve demos with empty table headings

- I opted to use visually empty headings, populated with EuiScreenReaderOnly text as an example for users looking to implement their own columns

+ fix odd data-test-subjs caused by either undefined or node column names

* Fix various axe failures on custom EuiTable example

- missing labels on checkbox elements, duplicate checkbox ID (solved in #5237)

- These are all a11y solutions that come OOTB in EuiBasicTable, but need to be added for the custom example

* Fix unsemantic headings in EuiBasicTable responsive documentation

- these should very likely just be paragraphs, not headings

* Re-enable basic table & in-memory table documentations in a11y tests

* Add changelog entry

* PR feedback: screen reader landmark copy
ym pushed a commit to ym/eui that referenced this pull request Oct 29, 2021
…ors on EuiBasicTable and EuiInMemoryTable pages (elastic#5241)

* Fix duplicate checkbox `id`s with multiple isSelectable EuiBasicTables on the page

- This is possibly only an issue with our docs and the fact that we use the same dataset repeatedly across multiple examples, but solves the error of duplicated IDs and shouldn't negatively affect production users

* Fix duplicate popover `id`s with multiple EuiInMemoryTable filters on the page

- there's no real need for this popover to have a custom ID instead of a randomized one - remove it

- This is possibly only an issue with our docs and the fact that we use the same dataset repeatedly across examples, but solves the error of duplicated IDs and shouldn't negatively affect production users

* Fix missing `aria-label` on table pagination

- An `aria-label` was being passed to the `PaginationBar` component, but it wasn't actually being correctly used:
  - `PaginationBar` was never passing an `aria-label` prop down to `EuiTablePagination` or `EuiPagination`
  - The i18n typing was passing a react element instead of a string via render prop

* Fix multiple `landmark-unique` issues on EuiBasicTable & EuiInMemoryTable docs

- While we added an aria-label for each table's paginatoin nav, they still need to be unique for multiple tables on the page, which means adding a tableCaption for each demo

* Fix `scope-attr-valid` errors on empty table column headings

- empty `td`s within a `thead` is valid per https://webaim.org/techniques/tables/data's examples, but should not have the `scope` attr set

* Improve demos with empty table headings

- I opted to use visually empty headings, populated with EuiScreenReaderOnly text as an example for users looking to implement their own columns

+ fix odd data-test-subjs caused by either undefined or node column names

* Fix various axe failures on custom EuiTable example

- missing labels on checkbox elements, duplicate checkbox ID (solved in elastic#5237)

- These are all a11y solutions that come OOTB in EuiBasicTable, but need to be added for the custom example

* Fix unsemantic headings in EuiBasicTable responsive documentation

- these should very likely just be paragraphs, not headings

* Re-enable basic table & in-memory table documentations in a11y tests

* Add changelog entry

* PR feedback: screen reader landmark copy
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.

3 participants