Skip to content

Commit 8dde159

Browse files
authored
Merge pull request #5116 from cardstack/cs-11328-primary-button-focus-ring
CS-11328: robust primary BoxelButton focus ring; darken with the fill
2 parents e380a20 + 1a4bd34 commit 8dde159

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

  • packages/boxel-ui/addon/src/components/selection-menu

packages/boxel-ui/addon/src/components/selection-menu/index.gts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,19 @@ export default class SelectionMenu extends Component<Signature> {
102102
--boxel-button-padding: var(--boxel-sp-5xs) var(--boxel-sp-xs);
103103
--boxel-button-min-width: 0;
104104
}
105-
/* Keyboard focus ring just outside the button. (Set explicitly so it
106-
renders regardless of the global button outline setup.) */
105+
/* Keyboard focus ring: a lighter tint of the current fill, so it stays
106+
visible against the highlight button (a highlight-colored ring would
107+
blend into it) while tracking the fill as it darkens. Sits snug
108+
against the button (1px) rather than floating off it. Defined here
109+
rather than on BoxelButton because boxel-ui's unlayered global
110+
`button:focus` rule overrides the button's own layered focus styles. */
107111
.selection-menu-trigger:focus-visible {
108112
outline: var(--boxel-outline-width) var(--boxel-outline-style)
109-
var(--boxel-highlight);
110-
outline-offset: 2px;
113+
color-mix(in oklab, var(--boxel-button-color) 70%, white);
114+
outline-offset: 1px;
111115
}
112-
/* Deepen the fill while the menu is open, matching Button's hover. */
116+
/* Deepen the fill while the menu is open, matching Button's hover; the
117+
focus ring's color-mix tracks the fill, so it darkens to match. */
113118
.selection-menu-trigger[aria-expanded='true'] {
114119
--boxel-button-color: var(--boxel-highlight-hover);
115120
}

0 commit comments

Comments
 (0)