Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
11a735e
Fix medium shortcut button padding
siddharthkp Nov 9, 2026
dc056b9
Match Button spacing across sizes
siddharthkp Nov 9, 2026
0fd8026
Consolidate Button shortcut padding rules
siddharthkp Nov 9, 2026
25577b5
Preserve modern Button CSS as an unused reference
siddharthkp Nov 9, 2026
465023f
Layer modern Button spacing over original styles
siddharthkp Nov 9, 2026
e6f5c0b
Button: add comparison feature stories
siddharthkp Nov 10, 2026
2ec907b
Button: match radius and font weight
siddharthkp Nov 10, 2026
aa78156
Ignore Playwright MCP artifacts
siddharthkp Nov 10, 2026
4d7f996
Button: apply antialiased font smoothing
siddharthkp Nov 10, 2026
df9a086
Delete .changeset/button-modern-spacing.md
siddharthkp Nov 10, 2026
46fe83e
Remove Button component test file
siddharthkp Nov 10, 2026
e10b6bb
Merge remote changes before pushing test deletion
siddharthkp Nov 10, 2026
d037083
Restore Button tests from main
siddharthkp Nov 10, 2026
7b275a1
Button: simplify unused modern stylesheet
siddharthkp Nov 10, 2026
ec6683a
Button: consolidate modernization line heights
siddharthkp Nov 10, 2026
d5d7628
Modernize ActionMenu styling and comparison stories
siddharthkp Nov 13, 2026
f85ebba
Modernize TextInput styling and comparison stories
siddharthkp Nov 14, 2026
24370a8
Modernize ToggleSwitch sizing and add compact controls
siddharthkp Nov 14, 2026
1187781
Modernize individual keyboard hint keycaps and contexts
siddharthkp Nov 14, 2026
0662a24
Modernize Dialog density, layout, and comparison stories
siddharthkp Nov 14, 2026
38f60eb
Modernize SelectPanel and preserve custom overlay styles
siddharthkp Nov 14, 2026
1cf8831
Document modernization review contract and align input size visuals
siddharthkp Nov 14, 2026
a103eb3
Preserve explicit SelectPanel maximum-height limits
siddharthkp Nov 14, 2026
5a9f91c
Match compact Dialog icons and restore comparison trigger focus
siddharthkp Nov 14, 2026
f746efa
Align switch indicators, state styling, and comparison fixtures
siddharthkp Nov 16, 2026
1fae6bd
Match SelectPanel search focus ring to panel corners
siddharthkp Nov 16, 2026
631603c
Use bare ticks for SelectPanel multiselect indicators
siddharthkp Nov 16, 2026
179ca67
Use bare ticks for SelectPanel modal radio indicators
siddharthkp Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/modernize-action-menu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

ActionMenu: Refine menu spacing, typography, icons, interaction styles, and trigger-button typography to match GitHub App.
5 changes: 5 additions & 0 deletions .changeset/modernize-dialog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

Dialog: Refine header, body, and footer spacing and add a small visual density.
5 changes: 5 additions & 0 deletions .changeset/modernize-keybinding-hint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

KeybindingHint: Refine individual keycap typography, sizing, and appearance.
5 changes: 5 additions & 0 deletions .changeset/modernize-select-panel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

SelectPanel: Refine menu and filter styling and support visually hidden titles.
5 changes: 5 additions & 0 deletions .changeset/modernize-text-input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

TextInput: Refine typography, spacing, visuals, and interaction styles.
5 changes: 5 additions & 0 deletions .changeset/modernize-toggle-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

ToggleSwitch: Refine sizing, thumb alignment, and disabled appearance, and add a compact size.
5 changes: 5 additions & 0 deletions .changeset/preserve-select-panel-overlay-styles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

SelectPanel: Preserve custom overlay styles, including popup dimensions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ storybook-static
coverage/

# Playwright
.playwright-mcp/
stats.html
blob-report
results.json
Expand Down
83 changes: 83 additions & 0 deletions contributor-docs/component-modernization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Component modernization experiment

This document records the ongoing work to bring GitHub App's newer visual treatment into Primer React. It describes this experiment, not a blanket requirement to migrate every component.

## Goal

Match the reference's typography, spacing, sizing, alignment, and interaction styling while keeping Primer's public APIs and behavior. Port the visual treatment, not the component implementation or its entire stylesheet.

Use the reference Storybook and app source as evidence. Do not claim that the running app was verified unless it was actually checked.

## Implementation boundaries

- Prefer the smallest complete change. Reuse existing Primer styles and override only the measured differences; do not duplicate styles that already work.
- Keep modernization styles component-scoped. Shared wrappers must not accidentally modernize unrelated consumers. For example, `TextInputWrapper` also serves Select, Textarea, and TextInputWithTokens.
- Put styles with the component that owns the surface: ActionMenu owns its trigger, while ActionList owns menu-row styling. Apply contextual changes only in the intended context.
- Preserve APIs, refs, keyboard behavior, controlled state, and accessibility. New behavior such as tokenization is a separate scope decision.
- Keep Primer's icons and theme tokens unless a change is explicitly agreed. Document intentional differences, including accessible opaque placeholders rather than faint reference placeholders and Primer's own high-contrast palettes.

## Required comparison artifact

Produce a standalone page using **live Storybook iframes**, not recreated controls or screenshots.

1. Put **GitHub App on the left** and **Primer React on the right**, with equal iframe viewport widths.
2. **Stack every example pair vertically** so they can be reviewed together. Do not use an example picker.
3. Match example content: labels, placeholders, initial values, descriptions, item order, sizes, and visual roles. Match image fixtures where relevant; different icon artwork is an intentional exception.
4. Keep one **theme picker controlling all examples**, plus a reset action that restores every example's initial state. Both sides remain interactive.
5. Label intentional differences on the page. On narrow screens, preserve equal-width side-by-side previews with horizontal scrolling rather than shrinking one side differently.

Keep comparison HTML separate from package runtime code and make it available as a review artifact. The page should link to its underlying stories.

Do not invent reference counterparts for unsupported patterns. The current TextInput page compares default, sizes with leading visuals, search with a clear action, and password inputs. Tokenized input is outside the current modernization scope; Primer-only success/loading states are checked separately.

## Working and verification loop

1. Read the reference implementation and stories alongside Primer's existing styles and shared consumers.
2. Align the stories' content before judging the visual result. Keep the same starting coordinates and control widths so layout differences are meaningful.
3. Measure the result rather than relying only on appearance: font size/weight/line-height, dimensions, padding, gaps, icon bounds, borders, colors, and focus outlines.
4. Check supported sizes and themes, LTR/RTL, narrow layouts, validation, disabled/read-only states, and interaction behavior. For custom search clear actions, check that there is no duplicate native clear control, clearing restores focus, and empty-state visibility preserves layout. Normal-size placeholder text must meet the 4.5:1 contrast requirement.
5. Before committing, format changed files and run the smallest relevant build, type-check, lint, component, and accessibility checks. Build before tests because package builds clear outputs that other workspaces import. Explain unrelated baseline failures; do not silently treat them as passing. Use the repository's Linux snapshot workflow for canonical visual baselines.

Keep the changeset accurate when runtime or public API changes are introduced or removed. See [testing](./testing.md), [CSS authoring](./authoring-css.md), and [versioning](./versioning.md) for the repository's standard guidance.

## Existing implementation examples

| Surface | Modernization styles |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------- |
| Button | [ButtonBase.modernize.module.css](../packages/react/src/Button/ButtonBase.modernize.module.css) |
| ActionMenu trigger | [ActionMenu.modernize.module.css](../packages/react/src/ActionMenu/ActionMenu.modernize.module.css) |
| ActionMenu's ActionList rows | [ActionList.modernize.module.css](../packages/react/src/ActionList/ActionList.modernize.module.css) |
| Plain TextInput | [TextInput.modernize.module.css](../packages/react/src/TextInput/TextInput.modernize.module.css) |
| Dialog | [Dialog.modernize.module.css](../packages/react/src/Dialog/Dialog.modernize.module.css) |
| Main-export SelectPanel | [SelectPanel.modernize.module.css](../packages/react/src/SelectPanel/SelectPanel.modernize.module.css) |
| ToggleSwitch | [ToggleSwitch.modernize.module.css](../packages/react/src/ToggleSwitch/ToggleSwitch.modernize.module.css) |
| Experimental KeybindingHint | [KeybindingHint.modernize.module.css](../packages/react/src/KeybindingHint/KeybindingHint.modernize.module.css) |

## Current batch boundaries

Modernize the main-export SelectPanel, not deprecated SelectPanel2, and the current Dialog, not DialogV1. Use the existing experimental KeybindingHint for Kbd/KbdChord comparisons; do not introduce replacement keyboard exports.

The approved visual additions are compact ToggleSwitch sizing, small Dialog density, and a visually hidden SelectPanel title that retains its accessible name. Keep existing defaults and state contracts. SelectPanel reuses ActionList's modernized surface and row styles; contextual keycap colors remain owned by Button and ActionList.

Primer deliberately retains visible switch labels and indicators, its modal radio/Cancel/Save semantics, spinner-only loading presentation, and its existing modifier ordering. App switch fixtures enable its differentiate-without-color preference; App modal fixtures use its public footer to match Cancel/Save content and commit behavior. Grouped virtualization and the App's global keyboard-shortcut visibility feature have no current Primer counterpart and are not fabricated.

## Local review setup

These addresses describe the current review environment, not the repository's default Storybook port:

| Resource | Address |
| ------------------------------ | ------------------------------------------------- |
| GitHub App reference Storybook | <http://localhost:6008> |
| Primer React Storybook | <http://localhost:6007> |
| TextInput stacked comparison | <http://localhost:6009/compare-text-inputs.html> |
| ActionMenu overlay comparison | <http://localhost:6009/compare-menus.html> |
| Dialog stacked comparison | <http://localhost:6009/compare-dialog.html> |
| SelectPanel stacked comparison | <http://localhost:6009/compare-select-panel.html> |
| Switch stacked comparison | <http://localhost:6009/compare-switch.html> |
| Keyboard stacked comparison | <http://localhost:6009/compare-kbd.html> |

Both Storybooks and the comparison-page server must be running. Port 6006 serves an unrelated Storybook in this setup; a missing entry in its MCP index does not mean a story is missing from Primer React. Verify the actual live story URLs.

The stacked side-by-side page is the default review format. An overlay can supplement it when investigating fine alignment differences.

The batch pages share a local comparison script and use lazy iframe loading to avoid mounting every story at once. SelectPanel previews retain desktop-width columns; narrower windows scroll horizontally rather than accidentally switching only one side into its responsive layout. Comparison fixtures in the reference worktree remain local and are not committed to that repository.
50 changes: 50 additions & 0 deletions e2e/components/ActionMenu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,56 @@ const featureFlagVariants = [
] as const

test.describe('ActionMenu', () => {
test.describe('Modernized menu', () => {
for (const id of [
'components-actionmenu-features--modernized-menu',
'components-actionmenu-features--modernized-menu-with-avatars',
]) {
for (const theme of themes) {
test(`${id} ${theme} @aat`, async ({page}) => {
await visit(page, {
id,
globals: {colorScheme: theme},
})
await expect(page.getByRole('menu')).toBeVisible()
await expect(page).toHaveNoViolations()
})
}
}

test('aligns avatars, loading indicators and submenu descriptions', async ({page}) => {
await visit(page, {id: 'components-actionmenu-features--modernized-menu-with-states'})
const menu = page.getByRole('menu')
await expect(menu.locator('[data-component="Avatar"]')).toHaveCount(3)
for (const avatar of await menu.locator('[data-component="Avatar"]').all()) {
await expect(avatar).toHaveCSS('width', '20px')
await expect(avatar).toHaveCSS('height', '20px')
}

const loading = page.getByRole('menuitem', {name: /^Loading reviewers/})
await expect(loading.locator('[data-component="Spinner"] svg')).toHaveCSS('width', '14px')
await expect(loading.locator('[data-component="Spinner"] svg')).toHaveCSS('height', '14px')

const inactive = page.getByRole('menuitem', {name: 'Request review', exact: true})
const inactiveIcon = await inactive.locator('svg').boundingBox()
const inactiveLabel = await inactive.locator('[data-component="ActionList.Item.Label"]').boundingBox()
expect(inactiveIcon!.y - inactiveLabel!.y).toBeCloseTo(3, 3)

const submenu = page.getByRole('menuitem', {name: 'More reviewers', exact: true})
await expect(submenu.locator('[data-description-variant]')).toHaveCSS('margin-right', '8px')
const chevron = await submenu.locator('[data-component="ActionList.TrailingVisual"] svg').boundingBox()
const label = await submenu.locator('[data-component="ActionList.Item.Label"]').boundingBox()
expect(chevron!.y - label!.y).toBeCloseTo(2, 3)

await submenu.focus()
await page.keyboard.press('ArrowRight')
await expect(page.getByRole('menuitem', {name: 'Design', exact: true})).toBeVisible()
await page.keyboard.press('ArrowLeft')
await expect(submenu).toBeFocused()
await expect(page.getByRole('menu')).toHaveCount(1)
})
})

for (const story of stories) {
test.describe(story.title, () => {
for (const theme of themes) {
Expand Down
16 changes: 16 additions & 0 deletions e2e/components/TextInput.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ import {visit} from '../test-helpers/storybook'
import {themes} from '../test-helpers/themes'

test.describe('TextInput', () => {
test.describe('Modernized accessibility', () => {
for (const theme of themes) {
test.describe(theme, () => {
for (const story of ['modernized-input', 'modernized-search', 'modernized-states']) {
test(`${story} @avt`, async ({page}) => {
await visit(page, {
id: `components-textinput-features--${story}`,
globals: {colorScheme: theme},
})
await expect(page).toHaveNoViolations()
})
}
})
}
})

test.describe('Default', () => {
for (const theme of themes) {
test.describe(theme, () => {
Expand Down
Loading
Loading