Hang a searchable choice's list as wide as its field

The searchable choice put its `anchor-name` on a `<div>` around its
field, and menu.css sizes the popover list with
`anchor-size(width)`. The wrapper fills its container, but from
`medium` the field inside it stops at 40rem, so in a wider pane the
list ran past the field's end across the whole container: 1168px under
a 640px field. Found while giving the choice `full`, which only hid it.

The field itself carries the anchor now and the wrapper is gone, so the
list is as wide as the field, bounded or `full`, and still hangs under
the field's supporting text as before.

A browser test opens a bounded and a `full` searchable choice in a
1200px column and compares each list's width and start with its field;
it fails without the change in Chrome, Firefox and Safari.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andreas Reinhold / reini
2026-09-17 07:06:25 +02:00
co-authored by Claude Opus 5
parent 7aa6dc7d33
commit 16c52d46e9
3 changed files with 80 additions and 36 deletions
+4
View File
@@ -87,6 +87,10 @@
card. `<x-choices>`' chips have no bound and take `full` without a change, so a call site can
switch `searchable` on and off. A width rule an application wrote around one of them for this
can go.
- **A searchable `<x-choices>`' list is as wide as its field.** It was anchored to a wrapper
around the field, which fills its container, so from `medium`, where the field stops at 40rem,
the list ran on past the field's end across the whole container. The field itself is the anchor
now, and the wrapper `<div>` is gone; the list keeps hanging under the field's supporting text.
## From 2.0.0 to 2.1.0