Skip to content

feat(web): replace native selects with an animated Select - #61

Merged
kalaspuff merged 5 commits into
mainfrom
fctl/26-we-should-have-a-proper-nice-ui-design-c
Oct 18, 2026
Merged

kalaspuff merged 5 commits into
mainfrom
fctl/26-we-should-have-a-proper-nice-ui-design-c

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

The web app chose roles, repository access, Claude's effort and projects with native <select> menus. They look like the operating system rather than fctl (on macOS: a blue highlight, a tick on the left, the system font), and they can't say what a choice means.

What changed

Select (web/src/components/ui/select.tsx) replaces all eight native selects: the project picker in the floor's composer, repository access (when adding one, and per repository), Claude's effort in project settings, project roles (when adding someone, and per member), instance roles in Admin → Users, and access in the share dialog.

  • Keys. The WAI-ARIA select-only combobox: focus stays on the trigger, which points at the highlighted option with aria-activedescendant. Arrows, Home and End, Page Up and Down, Enter and Space, Escape, Tab, and typeahead (typing a letter again moves on to the next option with it). Escape in a dialog closes the list, not the dialog. Global hotkeys treat a focused combobox like a native select.
  • Placement. The list opens in the top layer with the Popover API, so it shows above modal dialogs and outside containers that clip or blur their backdrop (the composer). It sits under its trigger, flips above when there is more room there, stays inside the window, follows its trigger when the page scrolls, and closes on blur, on a press elsewhere (iOS keeps focus on taps) and on Escape.
  • Pointer. A mouse opens it on press, and the press can be dragged onto an option and released to pick it, as with native menus. Touch and pens open it on tap, so a swipe that starts on the trigger still scrolls the page. Options are taller on coarse pointers.
  • Motion, quick and off with prefers-reduced-motion. The list grows out of its trigger while its options settle in one after another; a highlight glides between options after the pointer and the keys; the picked option flashes once, as menus do on macOS, and its check draws itself before the list closes; the new value rolls into the trigger, up or down the way it moved in the list; the chevron's arms swing from down to up while the list is open. Durations are 140–320 ms with the design system's out and spring curves.
  • Copy. Roles, repository access and sharing describe each choice on a second line, in the words of the definitions in fctl-proto and fctl-domain ("Also manages settings, secrets and members"). The project picker shows each project's repository. Labels are in sentence case ("Maintainer", not "maintainer").
  • Fixes on the way. Options people can't choose (making someone an owner, for those who aren't one) are shown disabled instead of hidden, so an owner's row no longer reads "member" to admins. Triggers are as wide as their longest option, so rows don't shift when a value changes. An empty value reads muted, as an option with value="" is a placeholder in HTML: an unset effort now looks like the unset model beside it. On a phone, a long project name truncates in the composer instead of pushing past it, and the start button keeps its width (it was clipped beside long names before too).

The component lives with the other primitives in web/src/components/ui and uses @hyperstructure/design's existing tokens and curves, so the design package doesn't change. AGENTS.md now points agents at Select for choices from a list.

Verification

  • Unit tests in select.test.tsx: stepping past disabled options, typeahead, opening on the selection, picking with Enter and with clicks, Escape, presses outside, the muted empty value. npm run check, npm test, npm run build and cargo xtask check pass.
  • With cargo xtask dev and Playwright, on the real pages in Chromium and Firefox: the keyboard flow with a visible focus ring, typeahead, Tab, mouse toggling and outside clicks without a focus ring, press, drag and release, the highlight following the pointer, the list following its trigger as the page scrolls, the share dialog (the list on top, Escape closing the list and then the dialog), and your own role disabled in Admin.
  • WebKit on Linux refuses the dev stack's __Host- session cookie over plain http, so the same checks ran against the component on a local page in WebKit, Firefox and Chromium, plus touch on an emulated iPhone 15 (WebKit) and Pixel 7 (Chromium).
  • Looked at in both themes, and at 390 px wide.

Screenshots

The session can't attach images to pull requests (#40), so here is what they show, taken with cargo xtask dev at 1280 px in both themes:

  • Before: native selects, closed: lowercase roles ("maintainer", "viewer") with the system's heavy chevron. Open, they are the operating system's menus (the screenshots in the session's task show macOS's).
  • After, closed: the same places and widths, sentence-case labels and a thin chevron; small triggers in rows, field-sized ones beside inputs.
  • After, open: a raised, blurred panel with a soft shadow under its trigger; options with a second line where it helps; a neutral highlight under the pointer; the selected option's check in the accent color (yellow in the dark theme, ink in the light). In the share dialog the list sits above the dialog and past its edge.

A recording of the motion, in real time at 60 fps, was shared in the session.

Session: https://app.fctl.sh/s/ses_01M57CJ21RDBHCEEA5FWCNKAGW

fctl-sh Bot and others added 5 commits October 18, 2026 11:56
The web app chose roles, repository access, effort and projects with
native <select> menus, which look like the operating system rather than
fctl and can't say what each choice means.

Select (components/ui/select.tsx) is a button with the keys of the
WAI-ARIA select-only combobox: arrows, Home and End, Page Up and Down,
Enter and Space, Escape, Tab and typeahead. Its list opens in the top
layer with the Popover API, so it shows above dialogs and outside
containers that clip. It grows out of its trigger, a highlight glides
after the pointer and the keys, the picked option flashes before the
list closes, its check draws itself, and the new value rolls into the
trigger in the direction of the list. A mouse press can be dragged onto
an option and released to pick it, as with native menus. Motion follows
prefers-reduced-motion.

Roles, repository access and session sharing describe each choice in a
second line, in the words of the roles' definitions; the composer's
project picker shows each project's repository. Options people can't
choose (making owners, for those who aren't one) are shown disabled
instead of hidden, so an owner's row no longer reads "member" to admins.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
iOS Safari keeps focus on a button when people tap elsewhere, so the
list now also closes on a press outside it. Cancelling pointerdown on
the list cancelled taps in WebKit; cancelling mousedown keeps focus on
the trigger without that. The list is never wider than the window, for
triggers as wide as a phone's screen. Hotkeys treat a focused combobox
like a native select, so typing to jump to an option can't trigger
them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An option with an empty value stands for no choice, as in HTML, so the
trigger shows it in the placeholder color: an unset effort now reads
like the unset model beside it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On a phone, a long project name made the composer's project picker
wider than its row. The trigger may now shrink, truncating its value,
when its row runs out of room, as the native select could; rows whose
other items take the free space are unchanged. The start button no
longer shrinks either, which clipped its label beside long names on
main too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kalaspuff
kalaspuff merged commit 409fa44 into main Oct 18, 2026
4 checks passed
@kalaspuff
kalaspuff deleted the fctl/26-we-should-have-a-proper-nice-ui-design-c branch October 18, 2026 12:36
kalaspuff pushed a commit that referenced this pull request Oct 20, 2026
…151)

On an iPhone or iPad, tapping the button of an open dropdown (a
`Select`) left its list open. A second tap now closes it, as a second
click with a mouse already did.

## What was wrong

Safari doesn't focus buttons on click. When a tap ends, Safari sends
`mousedown` and moves focus from the focused element to the nearest
mouse-focusable ancestor of the pressed button, or to nothing. On macOS
and iOS, buttons aren't mouse-focusable, so the trigger lost focus even
though it was the button tapped
([`HTMLFormControlElement::isMouseFocusable`](https://github.com/WebKit/WebKit/blob/3c91014a71276cef809bb95b8b9ab9ea2a4c9066/Source/WebCore/html/HTMLFormControlElement.cpp#L229-L240),
[`EventHandler::dispatchMouseEvent`](https://github.com/WebKit/WebKit/blob/3c91014a71276cef809bb95b8b9ab9ea2a4c9066/Source/WebCore/page/EventHandler.cpp#L3436-L3505)).
A `Select` closes its list when its trigger loses focus. So the second
tap closed the list on `mousedown`, and the tap's `click` found it
closed and opened it again. Chrome and the other browsers on iOS use
WebKit too, so they behaved the same way.

A mouse was unaffected: the trigger handles a mouse press on
`pointerdown` and cancels it. Cancelling it skips the `mousedown` and
its focus change. Chrome on Android focuses buttons on click, so the
trigger kept its focus there.

## What changed

The trigger cancels `mousedown`, as its list already does. A tap now
keeps focus on the trigger, and its click closes the list. Touch still
opens the list on click, so a swipe that starts on the trigger still
scrolls the page.

## Verification

- A new unit test in `select.test.tsx` taps the trigger twice the way
Safari on iOS delivers a tap: a `mousedown` that, unless cancelled,
takes focus away. It failed before this change (the list stayed open)
and passes now.
- Playwright drove the real component and the app's styles on a test
page, before and after the change. Playwright's WebKit is the Linux
port, which focuses buttons on click as Chrome does. That is why the
emulated iPhone in #61 didn't show the bug. So the iPhone runs also
added Safari's rule: a `mousedown` on a button, unless cancelled, moves
focus as Safari would.
- Before: tapping twice on an emulated iPhone 15 (WebKit) with Safari's
rule left the list open. Pixel 7 (Chromium), and the mouse in desktop
Chromium, WebKit and Firefox, closed it.
- After: the second press closes the list in all of them. Tapping or
clicking an option picks it, and focus stays on the trigger. A press
elsewhere closes the list. Pressing another dropdown's trigger closes
the first list and opens the second. A trigger opens from a focused text
field and takes focus from it. The arrow keys and Enter work after a
press, and a mouse can still press, drag onto an option and release to
pick it.
- `cargo xtask check --quick` passes.

There are no screenshots: nothing looks different. The list just closes
on the second tap.

Session: https://app.fctl.sh/s/ses_01M5DCMP24RSTE8CGHSVH4A4A9

Co-authored-by: fctl-sh[bot] <343971779+fctl-sh[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant