Skip to content

Commit a9cfa2f

Browse files
committed
fix(emcn): centralize neutral chip keyboard focus
1 parent 516fb13 commit a9cfa2f

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus
  • packages/emcn/src/components/chip

‎apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/menus/toolbar-menu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function ToolbarMenu({ editor, label, value, active, items }: ToolbarMenu
4545
<Chip
4646
rightIcon={ChevronDown}
4747
aria-label={label}
48-
className='h-10 w-[76px] focus-visible:bg-[var(--surface-hover)] sm:h-[28px]'
48+
className='h-10 w-[76px] sm:h-[28px]'
4949
onPointerDown={(event) => event.currentTarget.focus()}
5050
>
5151
{value}

‎packages/emcn/src/components/chip/chip.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
* - `chipVariants({...})` → any other element (`<div role='button'>`, `<DropdownMenuTrigger asChild>` inner, etc.)
3232
*
3333
* @remarks
34-
* The implicit **default** variant is the bare pill — transparent, `--surface-hover` on hover. Omit `variant`
34+
* The implicit **default** variant is the bare pill — transparent, `--surface-hover` on hover and keyboard focus. Omit `variant`
3535
* to get it (shadcn-style); never write `variant='default'`. Named variants:
3636
* `filled` (`--surface-5` light / `--surface-4` dark fill, `--surface-hover` hover) — a borderless surface reserved for
3737
* chip FIELDS/TRIGGERS ({@link ChipInput}/{@link ChipDropdown}/{@link ChipSelect}/{@link ChipDatePicker}), **never `Chip`
@@ -79,7 +79,11 @@ const chipVariants = cva(
7979
fullWidth: { true: 'flex w-full', false: 'inline-flex' },
8080
},
8181
compoundVariants: [
82-
{ variant: ['default', 'filled'], active: false, className: chipHoverSurfaceClass },
82+
{
83+
variant: ['default', 'filled'],
84+
active: false,
85+
className: `${chipHoverSurfaceClass} focus-visible:bg-[var(--surface-hover)]`,
86+
},
8387
{ variant: ['default', 'filled'], active: true, className: chipActiveSurfaceClass },
8488
],
8589
defaultVariants: { variant: 'default', shape: 'default', active: false, fullWidth: false },

0 commit comments

Comments
 (0)