Skip to content

agent-office: replace native <select> pickers in Settings with app menus - #771

Merged
yetone merged 1 commit into
magpie-community:mainfrom
frederick-wang:feat/5-settings-app-menus
Nov 5, 2026
Merged

yetone merged 1 commit into
magpie-community:mainfrom
frederick-wang:feat/5-settings-app-menus

Conversation

@frederick-wang

Copy link
Copy Markdown
Contributor

Summary

Fixes #744.

Replaces the three native <select> elements in packages/agent-office's Settings menu (#optLang, #optScene, #optQuality) with in-page Magpie-style listbox app menus (role="listbox"):

flowchart LR
    subgraph Before["Before (#740)"]
        S1["select#optLang.lang-select"] & S2["select#optScene.lang-select"] & S3["select#optQuality.lang-select"] --> Native["OS-native <select> popup\n(violates Magpie GUI rule)"]
    end

    subgraph After["After (#744)"]
        B1["button#optLang.lang-select\n(inline SVG .chev)"] --> L1["div#optLangList\n(role=listbox, fixed)"]
        B2["button#optScene.lang-select\n(inline SVG .chev)"] --> L2["div#optSceneList\n(role=listbox, fixed)"]
        B3["button#optQuality.lang-select\n(inline SVG .chev)"] --> L3["div#optQualityList\n(role=listbox, fixed)"]
    end
Loading
  • Trigger buttons (#optLang, #optScene, #optQuality): Replaced <select> with <button type="button" class="lang-select" aria-haspopup="listbox" aria-expanded="false"> containing .picker-val and the same inline <svg class="chev" viewBox="0 0 10 6"> used by #settingsBtn (rotating 180° when open), eliminating the light/dark data-URI background SVG select workarounds.
  • Viewport-clamped role="listbox" popovers (#optLangList, #optSceneList, #optQualityList): Positioned with position: fixed (minWidth matching the trigger, opening below or flipping above when bottom space is tighter than top space, clamped within 8px of viewport edges) so #settings's overflow: auto container never clips options.
  • Keyboard & pointer behaviour: Supports ArrowDown, ArrowUp, Home, End, Enter, Space, Tab, and Escape (closing the open picker first and returning focus to its trigger without closing #settings), capture-phase outside pointerdown, #settings scroll, and window resize dismissal, plus live label updates across all nine languages.
  • Tests & asset stamps: Updated test/browser.mjs and agent-office.test.mjs, and re-stamped page/index.html asset fingerprints with scripts/stamp-page.mjs.

Evidence

  • After (Light & Dark Themes — Custom App Menu Open):
Light Mode Dark Mode
Settings App Menu Light Settings App Menu Dark
  • Automated Verification:
    • HOME=<scratch> bun test packages/agent-office: 183 pass, 0 fail across 15 files.
    • bun packages/agent-office/scripts/stamp-page.mjs --check: 0 (all ?v= sha256 stamps verified).
    • bun scripts/check.mjs agent-office: ✓ registry.json.
    • Playwright 2x Retina verification (1200x820 and compact 600x620, light and dark): zero <select> elements, aria-expanded / 180° .chev rotation, viewport clamping, keyboard navigation, Escape closing picker before #settings, outside click dismissal, and 9-language live label updates.

Merge Danger

Door: Two-way (self-contained UI/DOM update inside packages/agent-office/page/* and its tests).

Blast Radius: Low (scoped to the three Settings pickers #optLang, #optScene, #optQuality in packages/agent-office).

…h app menus

Replace the three remaining native <select> elements in the Settings menu
(#optLang, #optScene, #optQuality) with Magpie-style listbox app menus:

- Turn #optLang, #optScene, and #optQuality into button triggers
  (aria-haspopup="listbox") carrying the shared inline SVG chevron (.chev)
  that rotates 180deg while open, removing the light/dark data-URI
  background-image select workarounds.
- Pair each trigger with a fixed-positioned role="listbox" menu
  (#optLangList, #optSceneList, #optQualityList) clamped within the
  viewport (opening below by default and flipping above when bottom space
  is tight) so #settings's overflow:auto container never clips options.
- Support keyboard navigation (ArrowUp/Down, Home, End, Enter, Space,
  Tab, and Escape closing the open picker first without closing #settings),
  capture-phase outside pointerdown, #settings scroll, and window resize
  dismissal, plus live label updates across all nine languages.
- Update test/browser.mjs and agent-office.test.mjs, and re-stamp asset
  fingerprints in page/index.html.

Closes #5
@yetone
yetone merged commit 1301724 into magpie-community:main Nov 5, 2026
2 checks passed
yetone added a commit that referenced this pull request Nov 5, 2026
Bumps agent-office to 0.3.3 so #771 (frederick-wang: Language, Scene
and Quality are in-page listbox menus, not native <select>s, #744)
reaches users; dist and npm stop at 0.3.2. Notes it in the changelog,
and moves cli.test.mjs's pinned ping version with it.

Run on mote at this tree (Bun 1.4.2, HOME=mktemp -d): packages/
agent-office bun test 183 pass; repo bun test 6184 pass, 20 skip, 0
fail; bun scripts/check.mjs exit 0; stamp-page.mjs --check 0.
Broken by hand: before the cli.test.mjs edit, the bump alone turned
"the authenticated standalone page..." red (0.3.2 vs 0.3.3).
Not tried: the page in a real magpie window. #773 has the two small
follow-ups from the review.
@yetone

yetone commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Thanks @frederick-wang! Merged and released as agent-office 0.3.3 (served from the dist branch). I tested it on mote in Chromium and WebKit, in light and dark themes, at two window sizes, with both mouse and keyboard, and saved picks come back after a reload. Two small follow-ups are in #773: a screen reader doesn't hear the current value, and in a narrow window, scrolling past the end of a list closes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent-office: Settings menu still uses three native <select> (optLang, optScene, optQuality)

2 participants