Closed Bug 1906110 Opened 7 months ago Closed 7 months ago

Focusing the urlbar with the mouse sometimes doesn't select all because the URL shifts due to icons inserted/removed before it

Categories

(Firefox :: Address Bar, defect, P3)

defect

Tracking

()

VERIFIED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: mak, Assigned: mak)

References

(Blocks 1 open bug)

Details

(Keywords: papercut, Whiteboard: [sng])

Attachments

(1 file)

Clicking on the urlbar to focus it, should normally Select All, so its contents are ready to be replaced.
Unfortunately often this doesn't work and I end up inserting some text in the middle of the URL.
I found this is due to a few (1px, 2px) mousemove between mousedown and mouseup, that I may inadvertently do.
This is normally not a problem, but because the URL shifts when we insert or remove icons before it, we end up causing a selection change (the mouse moved by 1 px, the url moved by many pixels, so now 1-3 characters are selected).

Other browsers solved this by not shifting the url between focused and unfocused state, though that means we can only have a fixed amount of space for icons before the url, we cannot dynamically insert or remove icons then.
Possible solutions to evaluate:

  1. don't collapse/uncollapse icons on focus change if mousedown. We can probably do this with a mousedown attribute and changing a few focused css rules. Icons would instead appear/disappear on mouseup
  2. we could ignore small mousemove (less than half of a character) when passing from focused to unfocused... this may potentially prevent some wanted selection change, or not catch larger mousemove that users with accessibility problems may do
Blocks: 1891862
Assignee: nobody → mak
Status: NEW → ASSIGNED
Attachment #9411568 - Attachment description: WIP: Bug 1906110 - Address bar content shifts when focusing on mousedown. → Bug 1906110 - Address bar content shifts when focusing on mousedown. r=jteow
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/e1d771b15d44 Address bar content shifts when focusing on mousedown. r=jteow,desktop-theme-reviewers,urlbar-reviewers,dao
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
Duplicate of this bug: 1875550

Reproduced the issue with Firefox 129.0a1 (2024-07-03) on macOS 14.
The issue is verified fixed with Firefox 136.0a1 (20250128161837) and Firefox 135.0b9 (20250124091819) on Windows 10, macOS 14 and Ubuntu 22.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: