Close a popup menu when the window is resized #15

Closed
asxpi wants to merge 0 commits from asxpi/anotherim-js:fix/menu-close-on-resize into develop
First-time contributor

A popup menu opens at the point pressed and stays there. Resizing the window moved the button it came from with the layout, and the menu was left behind with nothing under it. Seen with the chat header's "…" on the Linux desktop app.

It now closes on a window resize, as a desktop's own menus do (ui/src/views/overlays.ts, a resize listener calling ui.closeMenu() while a menu is open). Every popup menu is drawn there, so this covers all of them: the chat header's "…" and call menu, a message's menu with its reaction bar, a chat row's, the sort menu, the account menu and its More… submenu, contact info, room details, the thread pane, and the media viewer and browser.

On a touch screen the on-screen keyboard coming and going resizes the page too, and opening a menu often puts the keyboard down, so there only a change of width (the phone turned) closes it.

Native <select> dropdowns are the engine's own and aren't touched.

Tests: three cases in menu-overlay.test.ts: a mouse with any resize; a touch screen with a height-only resize versus a turn; and no menu open. All 13 in the file pass. make test-ui: 2177 passed. Two unhandled errors (message.chat_state: backend not started) came from chat-follow.test.ts under the full suite's load; it passes alone (27/27) with and without this change. Checked by hand in a local Flatpak build of 0.5.3 on GNOME: the menus close when the window is resized.

🤖 Generated with Claude Code

A popup menu opens at the point pressed and stays there. Resizing the window moved the button it came from with the layout, and the menu was left behind with nothing under it. Seen with the chat header's "…" on the Linux desktop app. It now closes on a window resize, as a desktop's own menus do (`ui/src/views/overlays.ts`, a `resize` listener calling `ui.closeMenu()` while a menu is open). Every popup menu is drawn there, so this covers all of them: the chat header's "…" and call menu, a message's menu with its reaction bar, a chat row's, the sort menu, the account menu and its More… submenu, contact info, room details, the thread pane, and the media viewer and browser. On a touch screen the on-screen keyboard coming and going resizes the page too, and opening a menu often puts the keyboard down, so there only a change of width (the phone turned) closes it. Native `<select>` dropdowns are the engine's own and aren't touched. **Tests:** three cases in `menu-overlay.test.ts`: a mouse with any resize; a touch screen with a height-only resize versus a turn; and no menu open. All 13 in the file pass. `make test-ui`: 2177 passed. Two unhandled errors (`message.chat_state: backend not started`) came from `chat-follow.test.ts` under the full suite's load; it passes alone (27/27) with and without this change. Checked by hand in a local Flatpak build of 0.5.3 on GNOME: the menus close when the window is resized. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A popup menu opens at the point pressed and stays there. Resizing the
window moved the button it came from with the layout, and the menu
was left behind where nothing was, as with the chat header's "...".

It closes on a resize now, as a desktop's own menus do. On a touch
screen the on-screen keyboard's coming and going resizes the page
too, and opening a menu often puts the keyboard down, so there only a
change of width (the phone turned) closes it.

Assisted-by: Claude:opus-5-5
Owner

Reviewed and merged into develop by hand with merge commit 9e033a8f, released in 0.5.6 (v0.5.6 = 33b27872, https://dev.another.im/another-im/anotherim-js/releases/tag/v0.5.6). The forge does not mark a hand merge as merged, so this PR is closed here.

Reviewed and merged into develop by hand with merge commit 9e033a8f, released in 0.5.6 (v0.5.6 = 33b27872, https://dev.another.im/another-im/anotherim-js/releases/tag/v0.5.6). The forge does not mark a hand merge as merged, so this PR is closed here.
ann closed this pull request 2026-10-16 08:50:03 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.