Close the popup menus on an outside click, via the popover API #51

Merged
lilleman merged 4 commits from menu-outside-click into main 2026-08-05 08:31:47 +02:00
Owner

The language picker, profile menu and row kebabs were <details>, so they only closed by clicking the trigger again. They are now a <button popovertarget> plus a [popover] panel: the browser dismisses them on an outside click or Esc, opening one closes the others, and the panel sits in the top layer where a scrolling table can no longer clip it.

Placement is CSS anchor positioning. The panel needs position-anchor: auto — a bare anchor() resolves to nothing in Chromium, Firefox and WebKit alike, measured in all three before choosing.

data-table.ejs stopped hand-rolling its kebab and calls the menu partial, so the pattern lives in one file. <details> stays in the nav tree, where it means disclosure rather than popup. A browser older than the popover API renders the panels inline, so Sign out is never stranded behind an inert button.

The language picker, profile menu and row kebabs were `<details>`, so they only closed by clicking the trigger again. They are now a `<button popovertarget>` plus a `[popover]` panel: the browser dismisses them on an outside click or Esc, opening one closes the others, and the panel sits in the top layer where a scrolling table can no longer clip it. Placement is CSS anchor positioning. The panel needs `position-anchor: auto` — a bare `anchor()` resolves to nothing in Chromium, Firefox and WebKit alike, measured in all three before choosing. `data-table.ejs` stopped hand-rolling its kebab and calls the `menu` partial, so the pattern lives in one file. `<details>` stays in the nav tree, where it means disclosure rather than popup. A browser older than the popover API renders the panels inline, so Sign out is never stranded behind an inert button.
lilleman added 1 commit 2026-08-05 01:38:13 +02:00
lilleman marked the pull request as work in progress 2026-08-05 01:38:26 +02:00
lilleman added 1 commit 2026-08-05 01:58:09 +02:00
lilleman added 1 commit 2026-08-05 02:23:48 +02:00
lilleman marked the pull request as ready for review 2026-08-05 02:26:44 +02:00
lilleman added 1 commit 2026-08-05 08:28:36 +02:00
Merge branch 'main' into menu-outside-click
CI / full-gate (push) Successful in 2m41s
Mirror / github-mirror (push) Successful in 6s
1d4c7c88c4
lilleman merged commit 1d4c7c88c4 into main 2026-08-05 08:31:47 +02:00
lilleman deleted branch menu-outside-click 2026-08-05 08:31:47 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: larvit/plainpages#51