Skip to content

fix(browser): double-click in the address bar selects a word, like other browsers - #27371

Merged
Jinwoo-H merged 2 commits into
mainfrom
url-double-click
Oct 11, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
url-double-click

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42 $\color{#cf222e}{\Huge{\mathbf{−}}}$​17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25

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:

  • Clicking into the bar selected the whole URL (correct).
  • Double-clicking 27021 in https://github.com/stablyai/orca/pull/27021 still selected the whole URL.
  • Clicking the page and then clicking the bar again often put a cursor in the bar instead of selecting the whole URL.

After (same as Chrome and Firefox):

  • One click into the bar selects the whole URL.
  • A double-click selects the word under the cursor (27021, stablyai).
  • A triple-click selects the whole URL.
  • A click in a bar that is already focused places the cursor.
  • Dragging across the bar still selects the dragged range.

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:

  • When the press focuses the bar, it focuses first and then clears. Focusing would otherwise bring the old selection back. This is the same rule Firefox's urlbar uses: it resets the selection on the press that focuses it.
  • On the second press of a double-click, it clears the select-all made by the first click.

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 27021 in the real dev app:

Before After
before-dbl.png after-dbl.png

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:

    • single click: whole URL → whole URL
    • re-click after leaving the bar: cursor → whole URL
    • double-click: whole URL → 27021
    • triple-click: whole URL → whole URL
    • click while focused: cursor → cursor
    • drag from outside the bar: dragged range (after)
  • A minimal Electron page with no Orca code confirms that a plain input selects 27021 on 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:web clean.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…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.
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b1cb149e-e51b-465c-b686-367ca9062933

📥 Commits

Reviewing files that changed from the base of the PR and between 1318d5e and 2d4282a.


📒 Files selected for processing (3)
  • src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.test.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/use-browser-address-bar-click-select.ts

💤 Files with no reviewable changes (1)
  • src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.



📝 Walkthrough

Walkthrough

BrowserAddressBar now uses useBrowserAddressBarClickSelect for mouse-down and click handling. The hook manages focus and selection, including collapsing a selection on a repeated press when the prior click selected all. Tests cover the second press in a double-click and a press after blur when the full URL remains selected.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 2d428

No actionable issue is established that would prevent merging. Triple-click behavior in the embedded browser remains unverified.

Pre-merge checks | Passed 3 | Failed 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check Warning The description explains the user-visible behavior, implementation, rationale, testing, visual proof, and scope. However, it lists the required linked issue as "None" and leaves the required full vali… Link an actual issue in the "Linked Issue" section. Also run or explicitly identify CI coverage for pnpm lint, pnpm typecheck, pnpm test, and pnpm build, then update the checklist and testing details.
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: fixing double-click behavior so the address bar selects a word like other browsers.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Description check

Explanation

The description explains the user-visible behavior, implementation, rationale, testing, visual proof, and scope. However, it lists the required linked issue as "None" and leaves the required full validation commands unchecked without stating that CI will cover them.


  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.test.tsx (1)

274-287: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Exercise 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 mousedown so 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
📥 Commits

Reviewing files that changed from the base of the PR and between 666d990 and 1318d5e.

📒 Files selected for processing (3)
  • src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.test.tsx
  • src/renderer/src/components/browser-pane/assemble-chrome/BrowserAddressBar.tsx
  • src/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.
@Jinwoo-H
Jinwoo-H merged commit 5a0795a into main Oct 11, 2026
29 checks passed
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