fix(ui): let Escape close a glyph's colors with the focus back on the glyph

Merged
DA
6h ago
+41-2

Follow-up to #11021, which merged two minutes after the review below arrived, so its fix didn't make it in.

The bug

This P1 review comment found it: open a section glyph's colors with Enter, Shift-Tab back to the glyph, then press Escape. The colors stay open. #11021's last commit stopped a press or focus moving onto the glyph from closing its colors (so pressing the glyph again with a real mouse closes them rather than reopening them). But Escape pressed on the glyph targets the glyph too, so it was exempted as well. In jsdom the picker's own popover then took the Escape and closed the whole picker instead.

The fix

  • Escape is never exempted from closing the colors.
  • While its colors are open, the glyph handles Escape itself, before the key reaches the window, where the picker's popover would act on it too. So Escape closes only the colors and leaves the picker open.

Checked

  • A new test in sidebar-sections.test.ts covers Escape with focus back on the glyph. It fails without the fix: the picker closes.
  • With native Chromium keys on the web dev app: Enter on Folder → focus on Black; Shift-Tab → Folder, colors still open; Escape → colors closed, focus on Folder, picker still open; Enter → colors again; Escape inside them → closed, focus back on Folder.
  • Ran: sidebar-sections.test.ts and manager-face-picker.test.ts (70 pass) and the packages/panel typecheck, on this branch, which is main plus this commit. Left to CI: the rest.

🤖 Generated with Claude Code