Repository navigation
fix(browser): double-click in the address bar selects a word, like other browsers - #27371
Conversation
…her browsers The click that focuses the address bar selects the whole URL. Chromium treats a press inside a selection as a possible text drag, so the second press of a double-click never picked a word, and re-clicking a blurred bar restored its old selection instead of selecting all. Clear that selection before the press (focusing first, as Firefox's urlbar does) so single, double and triple clicks match Chrome and Firefox.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No actionable issue is established that would prevent merging. Triple-click behavior in the embedded browser remains unverified. Pre-merge checks |
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.test.tsx (1)
274-287: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winExercise the blur-to-refocus sequence in this regression test.
The test sets the selection but never focuses and blurs the input. Add that lifecycle before the
mousedownso the test verifies the retained-selection path.Suggested fix
- input.setSelectionRange(0, url.length) + act(() => { + input.focus() + input.setSelectionRange(0, url.length) + input.blur() + })
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
15e35c2d-361c-4ea8-949b-d96ee32541b7
📒 Files selected for processing (3)
src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.test.tsxsrc/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.tsxsrc/renderer/src/components/browser-pane/assemble-chrome/use-browser-address-bar-click-select.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
…e its hook The focusing press now focuses and clears the selection itself, so focus can always select all and the bar no longer shares the press flag with its focus and blur handlers. A second press only meets a range our click made, so event.detail === 2 replaces the select-all flag.
ELI5
Double-clicking part of a URL in Orca's browser address bar selected the whole URL. In Chrome and Firefox it selects just the word you clicked, such as the PR number. Orca now does the same.
What Changed
Before:
27021inhttps://github.com/stablyai/orca/pull/27021still selected the whole URL.After (same as Chrome and Firefox):
27021,stablyai).Mechanism: the click that focuses the bar selects everything. Chromium treats a press inside an existing selection as the start of a possible text drag. So it skipped its normal double-click word selection. It also skipped placing the cursor when the press landed inside the selection the bar kept from before it lost focus. The address bar now clears that selection before the press:
Chromium's own word and line selection then runs unchanged. The click-selection logic moved into
use-browser-address-bar-click-select.ts.Why
Clearing the selection keeps Chromium's native word boundaries, so they stay exactly like Chrome's. The alternative was to compute word boundaries ourselves on
dblclick, which would drift from Chrome's rules. A smaller fix (only handling the double-click) left the refocus case broken, because both bugs come from the same cause.Linked Issue
None.
Visual Proof
Double-click on
27021in the real dev app:Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Ran the macOS dev app in the background and drove real mouse input over CDP. With the fix reverted, then restored:
27021A minimal Electron page with no Orca code confirms that a plain input selects
27021on double-click, and that our earlier select-all suppressed it.Two regression tests in
BrowserAddressBar.test.tsx. The double-click test fails without the fix. The address-bar suite passes (166 tests).oxlint, oxfmt,
check:code-quality:changed,tc:webclean.Review
Agent skill upstream boundary
Notes
Renderer-only input handling. No IPC, SSH, mobile, or remote impact. Chromium behaves the same on macOS, Linux, and Windows. Only macOS was tested by hand.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)