Skip to content

fix(SegmentedControl): set global focus styles - #5140

Merged
francinelucca merged 12 commits into
mainfrom
revert-5114-chore/revert-segmented-control
Oct 22, 2024
Merged

fix(SegmentedControl): set global focus styles#5140
francinelucca merged 12 commits into
mainfrom
revert-5114-chore/revert-segmented-control

Conversation

@francinelucca

@francineluccafrancinelucca commented Oct 17, 2024

Copy link
Copy Markdown
Member

Closeshttps://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

@changeset-bot

changeset-botBot commented Oct 17, 2024

Copy link
Copy Markdown

🦋 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
NameType
@primer/reactPatch

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

@github-actions

Copy link
Copy Markdown
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-actionsgithub-actionsBot 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-actionsBottemporarily deployed to storybook-preview-5140 October 17, 2024 03:08 Inactive
@github-actions

github-actionsBot commented Oct 17, 2024

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
packages/react/dist/browser.esm.js96.9 KB (-0.1% 🔽)
packages/react/dist/browser.umd.js97.25 KB (-0.03% 🔽)

@primer-integration

primer-integrationBot commented Oct 17, 2024

Copy link
Copy Markdown

🟢 golden-jobs completed with status success.

@francineluccafrancinelucca changed the title Reopen "set global focus styles"fix(SegmentedControl): set global focus stylesOct 17, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-5140 October 17, 2024 16:49 Inactive
@github-actions

Copy link
Copy Markdown
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
@github-actions

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

👋 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 ownerOctober 17, 2024 17:48
@francineluccafrancinelucca 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

@broccolinisoupbroccolinisoup left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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
Copy Markdown
Member

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

Yeah that makes sense to me!

@francineluccafrancinelucca added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 21, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-5140 October 21, 2024 20:45 Inactive
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 21, 2024
@francineluccafrancinelucca added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 21, 2024
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 21, 2024
@francineluccafrancinelucca added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 22, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-5140 October 22, 2024 15:25 Inactive
@github-actionsgithub-actionsBot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Oct 22, 2024
@github-actions
github-actionsBottemporarily deployed to storybook-preview-5140 October 22, 2024 15:36 Inactive
@francinelucca
francinelucca added this pull request to the merge queueOct 22, 2024
Merged via the queue into main with commit 73796d3Oct 22, 2024
@francinelucca
francinelucca deleted the revert-5114-chore/revert-segmented-control branch October 22, 2024 15:49
@primerprimerBot mentioned this pull request Oct 21, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: passingChanges in this PR do NOT cause breaking changes in gh/ghstaffAuthor is a staff memberstatus: review needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@francinelucca@broccolinisoup@TylerJDev