Closed Bug 1912416 Opened 2 years ago Closed 1 year ago

Pressing Ctrl+Shift+Left Arrow while all texts are highlighted in address bar unselects them

Categories

(Firefox :: Address Bar, defect, P3)

Firefox 129
x86_64
Windows 10
defect

Tracking

()

VERIFIED FIXED
134 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox132 --- wontfix
firefox133 --- verified
firefox134 --- verified

People

(Reporter: fornothingno.1, Assigned: mak)

References

(Regression)

Details

(Keywords: papercut, regression, Whiteboard: [sng])

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0

Steps to reproduce:

Open new tab and type in address bar "test1 test2 test3" as an example.
Press Ctrl+A or select texts with mouse from left to right.
Press Ctrl+Shift+Left Arrow.

Actual results:

Only test1 test2 get selected for a split second then gets unselected.

Expected results:

test1 test2 gets selected leaving test3.

Component: Untriaged → Address Bar
OS: Unspecified → Windows 10
Hardware: Unspecified → x86_64

The severity field is not set for this bug.
:mak, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(mak)
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(mak)
Keywords: papercut
Priority: -- → P3
Whiteboard: [sng]

This reproduces for me in 129.0.2 (via snap) on Ubuntu 22.04.4 (with Xorg window manager).

Regressed in https://phabricator.services.mozilla.com/D212790 (which fixed 1896128). I have browser.urlbar.trimURLs disabled (and the trim HTTPS option doesn't seem to be present in stable releases, but if it was I'd turn it off too), though this behavior applies regardless of those settings

Looking at D212790, this seems to be something that's explicitly implemented: pressing control+left while all text is selected sets the cursor to position 0 and clears the selection. Behavior with left isn't mentioned in bug 1896128 at all though, and I don't think the current behavior makes sense.

If I enter the text "https://en.wikipedia.org/wiki/Main_Page" in a regular text field (e.g. this comment form) and then select "en.wikipedia.org/wiki/Main_Page", pressing left or control+left clears the selection and puts the cursor before "en". It doesn't act like pressing home at all.

With D212790 and URL trimming enabled, selecting "en.wikipedia.org/wiki/Main_Page" and then pressing left makes the "https://" visible but leaves the cursor before "en" (the same as a regular text field), while pressing control+left moves the cursor to before the "https". This is inconsistent behavior (though I guess it could be mildly useful to be able to choose between these in some cases, though I'm not sure how anyone would naturally discover it).

The big problem is that D212790 only checks for control+left without caring about if shift is held. This doesn't matter for home (shift+home and home when everything is selected should both clear the selection) but does matter for control+left (where shift does cause different behavior with a selection).

I wonder if Mak was thinking of FN+Left instead of Control+Left, which on some devices acts as home. The device I'm currently using doesn't behave that way, but I have another one that does; I'm not sure if that generates DOM_VK_HOME or something else.

Flags: needinfo?(mak)

We're differenciating the behavior between Home-like and Left-like shortcuts, though this case seems not handled properly.

(In reply to pokechu022 from comment #5)

With D212790 and URL trimming enabled, selecting "en.wikipedia.org/wiki/Main_Page" and then pressing left makes the "https://" visible but leaves the cursor before "en" (the same as a regular text field), while pressing control+left moves the cursor to before the "https". This is inconsistent behavior (though I guess it could be mildly useful to be able to choose between these in some cases, though I'm not sure how anyone would naturally discover it).

It's inconsistent, but we feel like it brings more value to the user, one case we're considering what is shown, while when we guess the user intent is more like Home we move back to position 0. It's also consistent with other browsers, so users expectations are not broken when moving across browsers.

The big problem is that D212790 only checks for control+left without caring about if shift is held. This doesn't matter for home (shift+home and home when everything is selected should both clear the selection) but does matter for control+left (where shift does cause different behavior with a selection).

True.

I wonder if Mak was thinking of FN+Left instead of Control+Left, which on some devices acts as home. The device I'm currently using doesn't behave that way, but I have another one that does; I'm not sure if that generates DOM_VK_HOME or something else.

No, I actually wanted to handle Ctrl+Left, and I missed the Shift case, my fault.
Though I'd also be curious to know which keycode Fn+Left generates on your keyboard.

Assignee: nobody → mak
Status: NEW → ASSIGNED
Flags: needinfo?(mak)

Though I'd also be curious to know which keycode Fn+Left generates on your keyboard.

Looks like both Fn+left and Fn+F11 generate DOM_VK_HOME on the device in question (a Dell XPS laptop; I believe it would default to F11 being home and Fn+F11 being F11 but I swapped that in the BIOS). There is no dedicated Home key, and Fn+left being home isn't actually marked on the keyboard (though Fn+up and Fn+down are indicated as page up/page down). The current logic should work fine for this.

Duplicate of this bug: 1924947
Keywords: regression
Regressed by: 1896128
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/f44bddbea61a Ctrl+Shift+Left in the Address Bar should not unselect all. r=urlbar-reviewers,daisuke

Set release status flags based on info from the regressing bug 1896128

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch

I think this is happening both when browser.urlbar.trimHttps is true and when it is false so this would affect Firefox 132.

Flags: needinfo?(mak)

This is about browser.urlbar.untrimOnUserInteraction.featureGate pref, not browser.urlbar.trimHttps.

#isHomeKeyUpEvent is only used here and maybeUntrimURL bails out

Flags: needinfo?(mak)

My reading of the code is that it's this.selectionStart = this.selectionEnd = 0; that causes the text to be unselected. That's happening before and outside of #maybeUntrimUrl.

I'm able to reproduce the issue on WIndows 11 with Firefox 132 if I understand the steps in comment #0 correctly.

Oh, that's right, thank you for the pointer!
I should ask for uplift.

Attachment #9434232 - Flags: approval-mozilla-beta?

beta Uplift Approval Request

  • User impact if declined: Ctrl+Shift+Left doesn't work as expected in the address bar
  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: See comment 0
  • Risk associated with taking this patch: low
  • Explanation of risk level: trivial code change, limited impact
  • String changes made/needed: none
  • Is Android affected?: no
Flags: qe-verify+
Attachment #9434232 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [qa-triaged]

I have reproduced this issue on Win 11 with an affected Nightly build (2024-08-09), using STR from comment 0.

The issue is verified as fixed on latest Nightly 134.0a1 and Beta 133.0b3 under macOS 13, Ubuntu 22.04 and Win 11.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Duplicate of this bug: 1931771
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: