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

fix(SegmentedControl): set global focus styles #5140

Merged
merged 12 commits into from
Oct 22, 2024

Conversation

francinelucca
Copy link
Member

@francinelucca francinelucca commented Oct 17, 2024

Closes https://github.com/github/primer/issues/3381

This is a revert of #5114. Corrects the detected bug by adding an offset to the GlobalFocusStyles.

Adds focus styles for SegmentedControlButton and SegmentedControlIconButton components via calling getGlobalFocusStyles() to ensure focus styles comply with accessibility color contrast. This function explicitly adds focus state using color: colors.accent.fg. This fixes contrast issues when using safari's default focus state.

Before:
focus contrast error in primer's SegmentedControlButton

After #5029 (with bug):
SegmentedControlButton with focus but missing right border focus

Now:
focused SegmentedControlButton with correct focus and color contrast

Changelog

Changed

  • Adds call to getGlobalFocusStyles() in SegmentedControlIconButtonStyled and SegmentedControlButtonStyled definitions.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

  • Test SegmentedControl stories in preview deployment in safari, compare focus states to prod, ensure previous bug is no longer visible

Merge checklist

Copy link

changeset-bot bot commented Oct 17, 2024

🦋 Changeset detected

Latest commit: ec9afc8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Oct 17, 2024
@github-actions github-actions bot temporarily deployed to storybook-preview-5140 October 17, 2024 03:08 Inactive
Copy link
Contributor

github-actions bot commented Oct 17, 2024

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 96.9 KB (-0.1% 🔽)
packages/react/dist/browser.umd.js 97.25 KB (-0.03% 🔽)

@primer-integration
Copy link

primer-integration bot commented Oct 17, 2024

🟢 golden-jobs completed with status success.

@francinelucca francinelucca changed the title Reopen "set global focus styles" fix(SegmentedControl): set global focus styles Oct 17, 2024
@github-actions github-actions bot temporarily deployed to storybook-preview-5140 October 17, 2024 16:49 Inactive
Copy link
Contributor

Uh oh! @francinelucca, the image you shared is missing helpful alt text. Check your pull request body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

1 similar comment
Copy link
Contributor

Uh oh! @francinelucca, the image you shared is missing helpful alt text. Check your pull request body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/347474

@francinelucca francinelucca marked this pull request as ready for review October 17, 2024 17:48
@francinelucca francinelucca requested a review from a team as a code owner October 17, 2024 17:48
@francinelucca francinelucca added status: review needed integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh staff Author is a staff member and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Oct 17, 2024
Copy link
Member

@broccolinisoup broccolinisoup left a comment

Choose a reason for hiding this comment

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

Looks wonderful! 🌸

Should we add an e2e test for the focus state? Especially because we use a utility function for the focus styles which is great - just to be double sure that we don't introduce any visual regression if we ever make a change on the global utility focus styles. Let me know your thoughts 🙌🏻

@francinelucca
Copy link
Member Author

Should we add an e2e test for the focus state? Especially because we use a utility function for the focus styles which is great - just to be double sure that we don't introduce any visual regression if we ever make a change on the global utility focus styles. Let me know your thoughts 🙌🏻

Yesss , great idea ✨

@broccolinisoup
Copy link
Member

Should we add an e2e test for the focus state?

@broccolinisoup done in 8756ea4, 5736299. LMK if I did that right 😅

Yeah perfect! 🔥

Side note: Not sure if we need the focus state for all stories but I don't think we have any space issues so far; so maybe we should just keep them all until we can't 😅

@francinelucca
Copy link
Member Author

Side note: Not sure if we need the focus state for all stories but I don't think we have any space issues so far; so maybe we should just keep them all until we can't 😅

Was wondering that myself haha, what would be "standard" to just do it on the default for button/iconButton? maybe that makes more sense... happy to fix!

@broccolinisoup
Copy link
Member

what would be "standard" to just do it on the default for button/iconButton?

Yeah that makes sense to me!

@francinelucca francinelucca added this pull request to the merge queue Oct 22, 2024
Merged via the queue into main with commit 73796d3 Oct 22, 2024
43 checks passed
@francinelucca francinelucca deleted the revert-5114-chore/revert-segmented-control branch October 22, 2024 15:49
@primer primer bot mentioned this pull request Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: passing Changes in this PR do NOT cause breaking changes in gh/gh staff Author is a staff member status: review needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants