Skip to content

[EuiSkipLink] Improve overrideLinkBehavior UX#5996

Merged
cee-chen merged 5 commits intoelastic:mainfrom
cee-chen:skip-link
Jun 24, 2022
Merged

[EuiSkipLink] Improve overrideLinkBehavior UX#5996
cee-chen merged 5 commits intoelastic:mainfrom
cee-chen:skip-link

Conversation

@cee-chen
Copy link
Copy Markdown
Contributor

@cee-chen cee-chen commented Jun 23, 2022

Summary

Before:

before

Note: Scroll jump + how black focus outline remains after clicking on the container

After:

after

Checklist

  • Checked in Chrome, Safari, Edge, and Firefox
  • Added or updated jest and cypress tests
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

- [ ] Checked in both light and dark modes
- [ ] Checked in mobile
- [ ] Props have proper autodocs and playground toggles
- [ ] Added documentation
- [ ] Checked Code Sandbox works for any docs examples
- [ ] Checked for breaking changes and labeled appropriately
- [ ] Updated the Figma library counterpart

cee-chen added 2 commits June 23, 2022 13:17
- Do not set tabIndex to -1 if the element is already tabbable

- Remove the tabindex property on blur / once the user has moved focus off the element, to prevent focus hijinks after the fact

+ Add E2E Cypress tests to confirm behavior/prevent regressions
Unfortunately on Chrome `scrollIntoView` and `.focus()` without preventScroll keeps jumping down, which hides some content due to the sticky header

As such I added a position and viewport check to only scroll to the item if it's below (half) the viewport or the user scrolled down past the top
@cee-chen cee-chen requested a review from cchaos June 23, 2022 21:35
@cee-chen cee-chen marked this pull request as ready for review June 23, 2022 21:37
@kibanamachine
Copy link
Copy Markdown

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

Copy link
Copy Markdown
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.

🙌 I can't attest to the code but the behavior is much nicer. Thank you!

Tested in Chrome, FF, and Safari

@cee-chen
Copy link
Copy Markdown
Contributor Author

Sweet, thanks @cchaos! @1Copenut, do you have a quick sec for code review on this?

@cee-chen cee-chen requested a review from 1Copenut June 24, 2022 18:17
@kibanamachine
Copy link
Copy Markdown

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

Copy link
Copy Markdown
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.

LGTM!

@cee-chen cee-chen enabled auto-merge (squash) June 24, 2022 20:34
@kibanamachine
Copy link
Copy Markdown

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

@cee-chen cee-chen merged commit b1db81a into elastic:main Jun 24, 2022
@cee-chen cee-chen deleted the skip-link branch June 24, 2022 21:23
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.

4 participants