From cb289d11ea8abb3cbb152e68e0ec04dcb91ab1b7 Mon Sep 17 00:00:00 2001 From: austincalvelage Date: Thu, 22 Oct 2026 20:02:01 -0600 Subject: [PATCH 01/13] fix(mosaic): tighten phone input country selector spacing --- .changeset/tidy-phone-input-spacing.md | 2 ++ .../components/phone-input/phone-input.styles.ts | 10 ++++++++-- .../components/phone-input/phone-input.test.tsx | 16 ++++++++++++++++ .../src/components/phone-input/phone-input.tsx | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 .changeset/tidy-phone-input-spacing.md diff --git a/.changeset/tidy-phone-input-spacing.md b/.changeset/tidy-phone-input-spacing.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/tidy-phone-input-spacing.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/mosaic/src/components/phone-input/phone-input.styles.ts b/packages/mosaic/src/components/phone-input/phone-input.styles.ts index 23a6f199762..366d7735499 100644 --- a/packages/mosaic/src/components/phone-input/phone-input.styles.ts +++ b/packages/mosaic/src/components/phone-input/phone-input.styles.ts @@ -3,6 +3,12 @@ import * as stylex from '@stylexjs/stylex'; import { colorVars, radiusVars, shadowVars, space, typeScaleVars } from '../../tokens.stylex'; export const styles = stylex.create({ + trigger: { + borderWidth: 0, + backgroundColor: 'transparent', + paddingInlineEnd: 0, + paddingInlineStart: space['1.5'], + }, triggerContent: { gap: space['0.5'], alignItems: 'center', @@ -29,14 +35,14 @@ export const styles = stylex.create({ }, prefix: { gap: space['2'], - color: colorVars['--cl-color-brand'], + color: colorVars['--cl-color-foreground'], fontVariantNumeric: 'tabular-nums', paddingInlineEnd: 0, paddingInlineStart: space['2'], }, control: { fontVariantNumeric: 'tabular-nums', - paddingInlineStart: space['2'], + paddingInlineStart: space['1.5'], }, popup: { borderRadius: radiusVars['--cl-radius-lg'], diff --git a/packages/mosaic/src/components/phone-input/phone-input.test.tsx b/packages/mosaic/src/components/phone-input/phone-input.test.tsx index 5643f0358a3..3e25912ae5b 100644 --- a/packages/mosaic/src/components/phone-input/phone-input.test.tsx +++ b/packages/mosaic/src/components/phone-input/phone-input.test.tsx @@ -7,6 +7,22 @@ import { Field } from '../field'; import { PhoneInput } from './phone-input'; describe('Mosaic PhoneInput', () => { + it('opens the country picker from the keyboard and restores focus when dismissed', async () => { + const user = userEvent.setup(); + render(); + const trigger = screen.getByRole('button', { name: 'Country, United States' }); + + await user.tab(); + expect(trigger).toHaveFocus(); + expect(trigger).toHaveTextContent('πŸ‡ΊπŸ‡Έ'); + await user.keyboard('{Enter}'); + await waitFor(() => expect(screen.getByRole('combobox', { name: 'Search countries' })).toHaveFocus()); + await user.keyboard('{Escape}'); + + await waitFor(() => expect(trigger).toHaveFocus()); + expect(trigger).toHaveAttribute('aria-expanded', 'false'); + }); + it('focuses the country search when opened with a pointer', async () => { const user = userEvent.setup(); render(); diff --git a/packages/mosaic/src/components/phone-input/phone-input.tsx b/packages/mosaic/src/components/phone-input/phone-input.tsx index 3ca0d4386cf..b5c7cf9620c 100644 --- a/packages/mosaic/src/components/phone-input/phone-input.tsx +++ b/packages/mosaic/src/components/phone-input/phone-input.tsx @@ -207,6 +207,7 @@ export const PhoneInput = React.forwardRef(fu