Skip to content

fix: Improve focus style consistency - #92

Merged
dcalhoun merged 2 commits into
trunkfrom
fix/improve-focus-style-consistency
May 7, 2024
Merged

fix: Improve focus style consistency#92
dcalhoun merged 2 commits into
trunkfrom
fix/improve-focus-style-consistency

Conversation

@dcalhoun

@dcalhoun dcalhoun commented May 6, 2024

Copy link
Copy Markdown
Member

Proposed Changes

  • Prefer focus-visible styles over focusable to satisfy prior design guidance.
  • Remove unnecessary styles from seemingly non-focusable li element.

Testing Instructions

Verify keyboard focus styles

  1. Interact with the site navigation, starting/stopping sites using a keyboard.
  2. Verify focus styles work as expected while using a keyboard.

Verify pointer/cursor styles

  1. Interact with the site navigation, starting/stopping sites using a
    pointer/cursor/keyboard.
  2. Verify the focus styles do not linger after no longer hovering.
Before After
before.mov
after.mov

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
dcalhoun added 2 commits May 6, 2024 09:52
Improve consistency of focus styles in the app. Prefer `focus-visible`
to avoid lingering focus styles for users interacting with a pointer.
These do not appear to have an impact as the `li` element is not
focusable. The button child receives focus and has its own focus styles.
@dcalhoun dcalhoun self-assigned this May 6, 2024
return (
<li
className={ cx(
'flex flex-row min-w-[168px] h-8 hover:bg-[#ffffff0C] focus:bg-[#ffffff0C] rounded transition-all',

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The focus styles applied to the li element did not appear to have an impact, as the element is not focusable. The child button is the element focused when moving focus with the keyboard, which has its own focus styles with an outline.

@dcalhoun
dcalhoun requested a review from SiobhyB May 6, 2024 14:05
@dcalhoun

dcalhoun commented May 6, 2024

Copy link
Copy Markdown
Member Author

👋🏻 @SiobhyB I hope I provided clear explanation for my rationale in the descriptions, but please let me know if I could provide more context or if you have a different perspective on this subject. Thanks! 🙇🏻

@dcalhoun
dcalhoun marked this pull request as ready for review May 6, 2024 14:14
@wojtekn wojtekn changed the title fix: Improve focus tyle consistency May 6, 2024

@wojtekn wojtekn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the cleanup. The code change looks good, and the focus behavior seems better now.

@SiobhyB SiobhyB left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@dcalhoun, I tested and this looks good to me, too! Thanks for cleaning up and outlining your reasoning 🙌

@dcalhoun
dcalhoun merged commit 03c6a0b into trunk May 7, 2024
@dcalhoun
dcalhoun deleted the fix/improve-focus-style-consistency branch May 7, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants