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

a11y rework of [EuiPagination] and friends #3294

Merged
merged 12 commits into from
Jun 3, 2020

Conversation

myasonik
Copy link
Contributor

@myasonik myasonik commented Apr 10, 2020

Summary

EuiPagination now sports the following changes:

  • Everything is wrapped in a <nav> and the pages are in a <ul>
  • Renders as <a> (instead of <button>) if there is an id to point to (similar idea to a skip link using <a>)
    • If this is the case, will move focus to the id
    • Also adds aria-controls={id}
  • If the ellipses would only replace 1 page, renders the page number
  • Adds more context to prev and next pagination buttons of which page they will be going to for screen readers
  • Adds more context to the ellipses for screen readers
  • Adjusts spacing of ellipses to match page numbers

EuiBasicTable, EuiInMemoryTable and EuiDataGrid pass in aria-controls to their pagination to take full advantage of the new structure.

Breaking change

  • EuiPaginationButton now requires a pageIndex
    • Shouldn't be a huge deal because I don't think there's a real use case to use it outside of EUI

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • Checked in mobile
  • Checked in IE11 and Firefox
  • Props have proper autodocs
    - [ ] Added documentation 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

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

@kibanamachine
Copy link

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

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Mostly doing a quick functionality review:


Focus state

Do we really need a focus ring on the entire table after each page page selection? It seems excessive visually as users page through.

Screen Recording 2020-04-10 at 08 50 AM

Perhaps you can link to some guidelines?

Compressed version

These numbers shouldn't be buttons.

Screen Recording 2020-04-10 at 08 43 AM

Truncating / Number display

I don't think this is the fault of this PR, but the physical changes of this thing's width and position of the back button really concerns me. It shifts a lot and if the user is trying to use the previous arrow continuously, they have continuously move their mouse.

Screen Recording 2020-04-10 at 08 46 AM

font-weight: $euiFontWeightBold;

&#{&} {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this crazy selector? It just concatenates the original selector to itself like: .euiPaginationButton-isActive.euiPaginationButton-isActive. It seems like a hacky way to get specificity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like a hacky way to get specificity.

That's exactly what it is 😆 First saw it many years ago on CSS Wizardry

Sounds like it's not a pattern in EUI so I can switch it to something 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.

I wasn't sure how to best fix this without hacks... Do you have a suggestion?

src/components/pagination/_pagination_button.scss Outdated Show resolved Hide resolved
@myasonik

This comment has been minimized.

@snide
Copy link
Contributor

snide commented Apr 10, 2020

Do we really need a focus ring on the entire table after each page page selection? It seems excessive visually as users page through.

This is excessive, at the point of distraction, which is its own top level concern. I know I say this a lot, but there is a balance. This is a pattern I do not see regularly on even high accessibility websites.

I think ultimately only sometimes do you want to jump focus to the table itself. Sometimes you just want to continue tabbing through pagination.

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Reviewed the top-level usages of these changes (e.g. tables code), will wait on resolutions to existing conversations before really looking at pagination bar/button changes.

src/components/basic_table/basic_table.tsx Outdated Show resolved Hide resolved
src/components/basic_table/in_memory_table.test.tsx Outdated Show resolved Hide resolved
src/components/basic_table/pagination_bar.tsx Outdated Show resolved Hide resolved
src/components/basic_table/pagination_bar.tsx Outdated Show resolved Hide resolved
src/components/common.ts Show resolved Hide resolved
@chandlerprall
Copy link
Contributor

Totally agree with Dave's assessment of that focus jumping

@myasonik
Copy link
Contributor Author

All the comments here seem reasonable and it's good to move forward but moving this PR back to a draft as I need to step away from it for an indefinite while to focus on some Kibana work.

@myasonik myasonik marked this pull request as draft April 14, 2020 23:52
@myasonik
Copy link
Contributor Author

myasonik commented May 7, 2020

Don't think I can fully get back to this PR right now but wanted to merge master into it so it doesn't fall too far behind.

I addressed just the easiest PR feedback while I had it open.

Big change (that was easy to do) is I also removed focus ring from tables. Turns out, visible focus is only required on controls (things you can interact with) which is why things like skip links don't trigger giant visible focus rings around the entire main contents of the page.

How do folks feel about moving focus to the table with the giant focus ring gone?

@kibanamachine
Copy link

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

@myasonik myasonik marked this pull request as ready for review May 28, 2020 21:31
@myasonik
Copy link
Contributor Author

myasonik commented May 28, 2020

Have more time now so picking this back up.

To reiterate my previous question:

I also removed focus ring from tables. Turns out, visible focus is only required on controls (things you can interact with) which is why things like skip links don't trigger giant visible focus rings around the entire main contents of the page.

How do folks feel about moving focus to the table with the giant focus ring gone?

@kibanamachine
Copy link

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

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Talked over slack, but posting here so others can read. Functionally this works great.

How do folks feel about moving focus to the table with the giant focus ring gone?

Yes. That's fine. It works well in practice from what I see.

I made a quick video to go over some finer detail stuff with the table / data grid specifically in concert with the pagination controls. @myasonik and I talked about changing the caption and aria-label on the table/data-grid to better announce the pagination state. He's gonna try that out, otherwise from a functional perspective this looks 👍 to me.

http://snid.es/fb2bc2eb5db4

src/components/basic_table/basic_table.tsx Outdated Show resolved Hide resolved
src/components/pagination/pagination.tsx Outdated Show resolved Hide resolved
@myasonik
Copy link
Contributor Author

myasonik commented Jun 1, 2020

Added page state info to the table <caption> and grid aria-label/aria-labelledby.

If you watch Dave's video above, you'll see the table gets reread linearly when focus is moved to it. Did some testing and research and that seems to be expected.

Also tested in VO+Safari and it seems to read the caption like 50% of the time and move focus to the wrong element the other 50% so I think we're into screen reader/browser discrepancies at this point.

Windows screen reader testing for grid is on my to-do list (not planned for this PR, like within the next ~6 months) so I'll review this then as well.

@myasonik myasonik requested review from chandlerprall and snide June 1, 2020 23:16
Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

Changes so far LGTM; latest build failure was a known flaky unit test

@myasonik
Copy link
Contributor Author

myasonik commented Jun 2, 2020

retest

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

@myasonik and I noticed some browser inconsistencies, but they aren't the end of the world. I'm ok with this as it stands for merging.

@kibanamachine
Copy link

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

@myasonik myasonik merged commit 2859b52 into elastic:master Jun 3, 2020
@myasonik myasonik deleted the a11y/pagination branch June 3, 2020 19:56
myasonik pushed a commit that referenced this pull request Jun 3, 2020
Mistakenly put pagination changes (#3294) under wrong version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EuiPagination needs to better manage focus when clicking on numbers [EuiPagination] Accessibility issues
5 participants