Skip to content

fix(settings): scrollable panel + close on Escape/backdrop - #23

Open
brettchien wants to merge 1 commit into
mainfrom
fix/settings-scroll-and-modal-ux
Open

fix(settings): scrollable panel + close on Escape/backdrop#23
brettchien wants to merge 1 commit into
mainfrom
fix/settings-scroll-and-modal-ux

Conversation

@brettchien

Copy link
Copy Markdown
Owner

Summary

  • #settings-view had no overflow, so a config panel taller than the window had no way to scroll — content was just clipped by the parent's overflow:hidden.
  • Fix is not a bare overflow-y:auto: the panel centers .settings-card with justify-content:center, and centering an overflowing flex container leaves the start of the overflow unreachable by scroll (scrollTop can't go negative). Switched to justify-content:flex-start on #settings-view + margin:auto on .settings-card — same centered look when content fits, but auto margins clamp to 0 instead of going negative, so an oversized card scrolls from the top.
  • Added Escape-key and backdrop-click close for the settings modal (neither existed — only the 關閉 button worked).

Scope: #settings-view / .settings-card CSS + the settings-close wiring in sidepanel.js only. No other view touched.

Test plan

  • node --test test/*.test.js — 137/137 pass (unaffected; these changes aren't in the unit-tested modules)
  • Load unpacked extension, open Settings, resize/shrink the panel so content overflows → confirm you can scroll to both the top and bottom of the card
  • Confirm Escape and clicking the backdrop (outside the card) both close Settings; clicking inside the card does not

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

…Escape/backdrop

The config panel content could overflow the window with no way to scroll
(#settings-view had no overflow set). A bare overflow-y:auto is not enough
by itself though: the panel centers its card with justify-content:center,
and centering a flex container whose content overflows leaves the start of
the overflow unreachable by scroll (scrollTop can't go negative). Switch to
justify-content:flex-start + margin:auto on the card — same centered look
when it fits, but auto margins clamp to 0 instead of going negative, so an
oversized card scrolls from the top instead of losing its start.

Also closes the settings modal on Escape and on a backdrop click (outside
the card), matching standard modal UX — neither existed before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

1 participant