Closed Bug 1086524 Opened 10 years ago Closed 1 month ago

pressing Esc when address bar is selected should return focus to window

Categories

(Firefox :: Address Bar, enhancement, P3)

33 Branch
enhancement

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: projectsymphony, Assigned: richardscollin)

References

Details

(Keywords: parity-chrome, parity-edge, Whiteboard: [sng])

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:33.0) Gecko/20100101 Firefox/33.0 Build ID: 20141011015303 Steps to reproduce: I wanted to go back one page when the address bar was selected, but without using the mouse. So I pressed backspace and it didn't work, then I pressed cmd/alt and arrow keys but it didn't work either. Actual results: The address was cleared out in case of backspace, and the cursor went at the beginning or at the end of it. My keyboard was imprisoned in the address bar and the only way to exit was with a few tabs. Expected results: Ideally when pressing 'esc' when the address bar is selected (and there is no more undo to it) it should return priority to the window and allow to navigate history normally.
Summary: pressing esc should when address is selected should return priority to window → pressing esc when address is selected should return priority to window
Summary: pressing esc when address is selected should return priority to window → pressing Esc when address bar is selected should return focus to window
Press a several of Tab key may focus to page.
Severity: normal → enhancement
Component: Untriaged → Keyboard Navigation
OS: Mac OS X → All
Hardware: x86 → All
I have no problem with Alt+Left on Linux even if the address bar is focused. If I had, I'd use F6 to switch focus.
QA Whiteboard: [bugday-20141027]
A workaround is to use Tab to move focus from the address bar to the page.
This is still an issue. On a Mac the F6 key is very inconvenient (requires Fn key), and the Esc key just makes more sense-- it performs this function in every other pane or input box.

To [::dao] or anyone: I'd like to give this a stab.

Before I try to get my hands in the code, is there any good reason (UX? Backwards compatibility? Addons?) for not implementing this?
(And that would mean an eventual patch of mine would be refused 😕)

Severity: normal → S3

Still a problem in 111.0.1
I have my capslock key mapped to escape (just like many other vim users), so any other alternative key combination by comparison is just plain un-ergonomic.
I'm very much hoping that this very standard UX behavior will be implemented soon.

I recently switch from Chrome to Firefox and this is driving me crazy. Every other input box loses focus when pressing escape. It makes sense to do the same or at least give an option for this behavior in the address bar.

When in the address bar and not a user typed value
Esc will focus the window

Assignee: nobody → flippidippi
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: flippidippi → nobody
Status: ASSIGNED → NEW

Hi, I'm also wanting this feature. I actually implemented a fix for myself before logging in on bugzilla and realizing that a fix has already been implemented, but there are some outstanding revisions requested. I am not very familiar with the process of contributing, but if I address the comments in phabricator with a changeset is there hope for getting this functionality reviewed and added? Maybe the original contributor is still interested in completing the work, if not then I'm willing to take it over.

Flags: needinfo?(mak)
Flags: needinfo?(flippidippi)
Flags: needinfo?(dao+bmo)

Yes, we'd accept patches, and addressing comments is a good start.
There's some contributor documentation at https://firefox-source-docs.mozilla.org/setup/contributing_code.html

Flags: needinfo?(mak)
Flags: needinfo?(dao+bmo)

Redirect a needinfo that is pending on an inactive user to the triage owner.
:dao, since the bug has recent activity, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(flippidippi) → needinfo?(dao+bmo)

Hey Collin, looks like flippidippi is inactive, so this is good to pick up.

Component: Keyboard Navigation → Address Bar
Flags: needinfo?(dao+bmo) → needinfo?(richardscollin)
Assignee: nobody → richardscollin
Status: NEW → ASSIGNED

I addressed most of the issues in a new changeset. Please let me know if there are any other desired changes.

Flags: needinfo?(richardscollin) → needinfo?(dao+bmo)
Attachment #9333244 - Attachment is obsolete: true
Pushed by dgottwald@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c052f2639595 Focus window on Esc in address bar r=dao,urlbar-reviewers

Backed out for causing multiple browser failures related to urlbar.

Flags: needinfo?(dao+bmo)
Flags: needinfo?(richardscollin)
Flags: needinfo?(dao+bmo)

The failing accessible/tests/browser/events/browser_test_selection_urlbar.js test relies on being able to press escape twice after window open to more reliably select the url text. Now pressing escape multiple times will result in the url text deselected and then the url bar unfocused. I could only reliably get this test to succeed by removing both of the calls to escape.

The failing tests in browser/components/urlbar/tests/browser/browser_UrlbarInput_searchTerms_revert.js are related to restoring logic with browser.urlbar.showSearchTerms.featureGate enabled. Changing the call from this.input.handleRevert(true) to this.input.handleRevert(false) in UrlbarController.sys.mjs:334 seemed to have the desired behavior when testing the url reset behavior manually, but don't cause the tests to pass.

I'll spend some more time this week investigating and trying to get these tests to pass.

Severity: S3 → N/A
Priority: -- → P3
Whiteboard: [sng]

Hey Collin, have you had the chance to take another look at getting those tests to pass? No pressure, just checking to make sure this bug doesn't get lost. Let us know if we can help. Thanks!

Flags: needinfo?(dao+bmo)

No, I haven't had a chance to investigate much further then I did previously. Once I have a bit of free time I'll post another changeset.

For the failing accessibility test I'm tempted to remove the two calls to synthesize the escape key in accessible/tests/browser/events/browser_test_selection_urlbar.js, but the comments make me think they might have originally there to avoid flaky tests. Any thoughts on that?

Flags: needinfo?(dao+bmo)

(In reply to Collin Richards from comment #20)

No, I haven't had a chance to investigate much further then I did previously. Once I have a bit of free time I'll post another changeset.

For the failing accessibility test I'm tempted to remove the two calls to synthesize the escape key in accessible/tests/browser/events/browser_test_selection_urlbar.js, but the comments make me think they might have originally there to avoid flaky tests. Any thoughts on that?

I think that's fine. The test is a few years old and there's a chance that what was flaky isn't anymore. It passes for me locally with that change.

Regarding browser_UrlbarInput_searchTerms_revert.js, it looks like we might be hitting Esc too often in the local synthesizeRevert function. Removing { repeat: 2 } seems to make the test pass, but I haven't fully read through the test to see that it still tests what it's supposed to test.

Does this help?

Flags: needinfo?(dao+bmo)

(In reply to Dão Gottwald [:dao] from comment #21)

(In reply to Collin Richards from comment #20)

No, I haven't had a chance to investigate much further then I did previously. Once I have a bit of free time I'll post another changeset.

For the failing accessibility test I'm tempted to remove the two calls to synthesize the escape key in accessible/tests/browser/events/browser_test_selection_urlbar.js, but the comments make me think they might have originally there to avoid flaky tests. Any thoughts on that?

I think that's fine. The test is a few years old and there's a chance that what was flaky isn't anymore. It passes for me locally with that change.

Regarding browser_UrlbarInput_searchTerms_revert.js, it looks like we might be hitting Esc too often in the local synthesizeRevert function. Removing { repeat: 2 } seems to make the test pass, but I haven't fully read through the test to see that it still tests what it's supposed to test.

I updated the patch with these two test fixes, however there's still an issue with browser_ime_composition.js that I'm not sure how to resolve: https://treeherder.mozilla.org/jobs?repo=try&revision=cb55c3367a2b3ad48af354c95da299d4454dec12&selectedTaskRun=RN1RgNOFR_CXrfaaX1YaKw.0
Marco, do you have ideas here?

Flags: needinfo?(mak)
Attachment #9418419 - Attachment description: Bug 1086524 - Focus window on Esc in address bar r=dao → Bug 1086524 - Focus window on Esc in address bar r=dao,#urlbar-reviewers

(In reply to Dão Gottwald [:dao] from comment #22)

I updated the patch with these two test fixes, however there's still an issue with browser_ime_composition.js that I'm not sure how to resolve: https://treeherder.mozilla.org/jobs?repo=try&revision=cb55c3367a2b3ad48af354c95da299d4454dec12&selectedTaskRun=RN1RgNOFR_CXrfaaX1YaKw.0
Marco, do you have ideas here?

Off-hand I would guess some of the ESC press before composeAndCheckPanel are excessive, the panel is already closed (we close the panel on compositionstart) and we press ESC thinking it's open, and then with this patch the urlbar loses focus and composition fails.
Maybe promisePopupClose should check the panel is effectively open before executing the closeFn?

Flags: needinfo?(mak) → needinfo?(dao+bmo)

(In reply to Marco Bonardo [:mak] from comment #23)

Off-hand I would guess some of the ESC press before composeAndCheckPanel are excessive, the panel is already closed (we close the panel on compositionstart) and we press ESC thinking it's open, and then with this patch the urlbar loses focus and composition fails.

That's helpful, thanks. Wasn't sure about the implied panel states around composition.

Maybe promisePopupClose should check the panel is effectively open before executing the closeFn?

Yeah, I think it should probably report a failure in that case. However, to get this landed, I'll first try to fix browser_ime_composition.js specifically and see if that's sufficient, and if so we can revisit promisePopupClose in a separate bug.

Flags: needinfo?(dao+bmo)
Pushed by dgottwald@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c03123359b41 Focus window on Esc in address bar r=dao,urlbar-reviewers

Backed out for causing

[task 2024-10-16T12:56:34.416Z] 12:56:34     INFO - TEST-PASS | browser/components/urlbar/tests/browser/browser_persist_searchMode.js | Urlbar should never be in search mode without the corresponding attribute. - true == true - 
[task 2024-10-16T12:56:34.417Z] 12:56:34     INFO - Buffered messages finished
[task 2024-10-16T12:56:34.417Z] 12:56:34     INFO - TEST-UNEXPECTED-FAIL | browser/components/urlbar/tests/browser/browser_persist_searchMode.js | gURLBar.searchMode should exist as expected - true == false - 
[task 2024-10-16T12:56:34.417Z] 12:56:34     INFO - Stack trace:
[task 2024-10-16T12:56:34.417Z] 12:56:34     INFO - resource://testing-common/UrlbarTestUtils.sys.mjs:assertSearchMode:827
[task 2024-10-16T12:56:34.418Z] 12:56:34     INFO - chrome://mochitests/content/browser/browser/components/urlbar/tests/browser/browser_persist_searchMode.js:test_escape_searchmode:113
[task 2024-10-16T12:56:34.418Z] 12:56:34     INFO - chrome://mochikit/content/browser-test.js:handleTask:1145
[task 2024-10-16T12:56:34.418Z] 12:56:34     INFO - chrome://mochikit/content/browser-test.js:_runTaskBasedTest:1217
[task 2024-10-16T12:56:34.418Z] 12:56:34     INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1358
[task 2024-10-16T12:56:34.418Z] 12:56:34     INFO - chrome://mochikit/content/browser-test.js:nextTest/<:1134
[task 2024-10-16T12:56:34.418Z] 12:56:34     INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/<:1058

Please check the other failures in the log.

Pushed by dgottwald@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c3560df7c73f Focus window on Esc in address bar r=dao,urlbar-reviewers
Pushed by dgottwald@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/91c817b56f61 Focus window on Esc in address bar r=dao,urlbar-reviewers
Flags: needinfo?(richardscollin)
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 133 Branch
Regressions: 1926435
Duplicate of this bug: 1556154
Blocks: 1929014
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: