You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6535684
Browse filesBrowse the repository at this point in the historyBrowse files
feat(scan): add safeArea option + allow text selection inside toolbar
safeArea (#430)
---------------
Other dev overlays (most notably the Next.js dev indicator) sit in
the same screen corners as the React Scan toolbar. The expanded
toolbar and collapsed bookmark would overlap them with no way for
the user to inset the toolbar.
Adds an \`Options.safeArea\` field that accepts either:
- a single number (insets all four edges, default 24)
- a per-edge \`{ top?, right?, bottom?, left? }\` object
Refactors the hard-coded \`SAFE_AREA\` constant out of widget
positioning math (\`calculatePosition\`,
\`calculateNewSizeAndPosition\`, \`WindowDimensions\`,
collapsed-corner positioning, max-size CSS) to read from a new
\`getSafeArea()\` helper that resolves per-edge from options at
runtime.
Module-init defaults still use the raw \`SAFE_AREA\` constant —
options haven't been set yet at that point, and reading them
through \`ReactScanInternals.options.value\` from a top-level
module would create a load-bearing optional chain through a
circular import.
\`defaultWidgetConfig\` is preserved as a deprecated alias of
\`getDefaultWidgetConfig()\` for one minor version.
\`parseSafeAreaOption\` is split out as a standalone utility (one
function per file per AGENTS.md) with a unit-test matrix covering
arrays, NaN, negative numbers, partial objects, and non-objects.
Toolbar text selection (#415)
-----------------------------
The toolbar root has \`select-none\` (so dragging the bar doesn't
start a text selection), and its root \`onPointerDown\` handler
calls \`e.preventDefault()\` (which suppresses focus and selection
on every click). Together those two made the AI-prompt \`<pre>\`
text impossible to highlight or copy.
Fix:
- New \`TOOLBAR_INTERACTIVE_SELECTOR\` constant lists the elements
that should bypass drag and accept native focus/selection. Used
from both the JSX (drag handler bail-out) and the CSS
(\`user-select: text\` re-enable). Single source of truth.
- \`handleDrag\` now bails — without calling \`preventDefault()\` —
when the pointerdown lands on a button, link, input, textarea,
select, pre, contenteditable, or \`[data-react-scan-selectable]\`.
- Flat CSS selectors (no nesting) so the rule applies in older
Firefox/Safari that lack native CSS nesting.
Note: this is a small behavior change for button clicks — the
original code called \`preventDefault()\` even on button hits;
buttons now receive native focus on pointerdown.
0 commit comments