Skip to content

fix(settings): allow text selection in settings panel#122

Merged
quiet-node merged 1 commit intomainfrom
fix/settings-text-selection
May 2, 2026
Merged

fix(settings): allow text selection in settings panel#122
quiet-node merged 1 commit intomainfrom
fix/settings-text-selection

Conversation

@quiet-node
Copy link
Copy Markdown
Owner

Summary

  • Settings panel previously had user-select: none on the root .window and a drag handler whose interactive-tag opt-out missed text tags (<p>, <span>, <code>, headings). Click-and-drag on text moved the whole NSPanel instead of starting a selection, so users couldn't highlight or copy any text inside Settings.
  • This PR keeps the chrome (top padding, tab bar) draggable while making body and banner text selectable, and teaches the drag handler to bail when the mousedown target is a text-bearing leaf.

What changed

  • src/styles/settings.module.css: .body and .banner now declare user-select: text. The window-wide user-select: none on .window still applies to chrome.
  • src/settings/SettingsWindow.tsx handleDragStart:
    • Bail when e.button !== 0 so right/middle-click pass through cleanly.
    • After the existing interactive-tag walk, bail when the target element directly contains a non-empty text node. Layout wrappers (<div>, <section>) without their own text still drag, so empty regions and gaps preserve the "click anywhere blank to drag" feel.
  • Tests: two new cases in SettingsWindow.test.tsx cover the text-leaf no-drag path (banner <code>) and the non-primary-button no-drag path.

Why this design

  • CSS-driven selectability matches the natural macOS expectation: text is selectable, chrome is not.
  • Keeping the drag handler in JS (rather than data-tauri-drag-region) preserves the existing fallback for nested form children, which the attribute can't handle reliably at the root.
  • "Direct text node" is a tighter signal than "any descendant has text" — it lets selectability and dragability coexist on the same parent without the window snatching the cursor mid-highlight.

Test plan

  • bun run test:all:coverage — frontend + backend pass, coverage gate holds (100% lines/functions).
  • bun run validate-build — lint, format, typecheck, build all clean.
  • Manual: open Settings, drag empty area → window moves; click-drag across a label/value → selection starts; Cmd+C copies; Cmd+, and Cmd+W still work; tab buttons and form inputs still respond to clicks.

Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
@quiet-node quiet-node merged commit 5c552cb into main May 2, 2026
3 checks passed
@quiet-node quiet-node deleted the fix/settings-text-selection branch May 2, 2026 22:54
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