Skip to content

Migrate the TabNav component to use CSS modules #6176

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jonrohan
Copy link
Member

@jonrohan jonrohan commented Jun 6, 2025

Changelog

New

Changed

Migrating TabNav to use CSS modules

Removed

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

Merge checklist

@Copilot Copilot AI review requested due to automatic review settings June 6, 2025 18:18
@jonrohan jonrohan requested a review from a team as a code owner June 6, 2025 18:18
@jonrohan jonrohan requested a review from hectahertz June 6, 2025 18:18
Copy link

changeset-bot bot commented Jun 6, 2025

🦋 Changeset detected

Latest commit: 25e3be4

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 Minor

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 github-actions bot added staff Author is a staff member integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Jun 6, 2025
Copy link
Contributor

github-actions bot commented Jun 6, 2025

👋 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!

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the TabNav component from styled-components to CSS Modules, replacing custom styled wrappers with BoxWithFallback and adding scoped CSS in TabNav.module.css.

  • Swapped out styled-components usage for BoxWithFallback and CSS module classes.
  • Introduced TabNav.module.css to encapsulate styles for the nav, tab list, links, and selected state.
  • Updated tests to remove the Box wrapper and use a plain <div> for markup.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/react/src/TabNav/tests/TabNav.test.tsx Replaced <Box> wrapper with <div>
packages/react/src/TabNav/TabNav.tsx Removed styled-components, wired up CSS modules
packages/react/src/TabNav/TabNav.module.css New CSS module for TabNav layout and styles
Comments suppressed due to low confidence (1)

packages/react/src/TabNav/TabNav.module.css:29

  • CSS module files typically do not support Sass mixins by default. Either convert this file to a .module.scss with proper preprocessor support or replace the mixin with valid PostCSS/CSS syntax for focus styles.
    @mixin focusOutline -6px;

ref={ref}
role="tab"
tabIndex={-1}
aria-selected={selected ? true : undefined}
Copy link
Preview

Copilot AI Jun 6, 2025

Choose a reason for hiding this comment

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

For role="tab", aria-selected should always be present with a boolean value (true or false). Change to aria-selected={selected} so it does not get omitted.

Suggested change
aria-selected={selected ? true : undefined}
aria-selected={selected}

Copilot uses AI. Check for mistakes.

Copy link
Contributor

github-actions bot commented Jun 6, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 94.51 KB (0%)
packages/react/dist/browser.umd.js 94.64 KB (0%)

@github-actions github-actions bot requested a deployment to storybook-preview-6176 June 6, 2025 18:22 Abandoned
@primer-integration
Copy link

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

@primer-integration
Copy link

🔴 golden-jobs completed with status failure.

@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: failing Changes in this PR cause breaking changes in gh/gh staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants