New issue
Advanced search Search tips

Issue 852332 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

cmd+left arrow/cmd+right arrow shortcut does not work in address bar

Reported by k3d...@gmail.com, Jun 13 2018

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3455.0 Safari/537.36

Steps to reproduce the problem:
1. Place the cursor on the address bar
2. Press Cmd + left arrow
3. The cursor does not go to the start of the address bar

What is the expected behavior?
The cursor should move to the beginning of the line in the address bar

What went wrong?
Cursor does not move on pressing the shortcut Cmd + Left arrow

Did this work before? Yes 

Chrome version: 69.0.3455.0  Channel: canary
OS Version: OS X 10.13.1
Flash Version:
 
Owner: erikc...@chromium.org
Status: Assigned (was: Unconfirmed)
It looks like this is causing history navigation instead. Observing this on 3456 views and cocoa.
The implementation of [NSApplication sendEvent:] first calls:
  (1) [NSApplication _handleKeyEquivalent:], which calls routeKeyEquivalent().
If that returns NO, then it calls:
  (2) [NSWindow sendEvent:] (this method returns void, as it's the last consumer of NSEvents)
    * This goes through typical responder chain logic. On views, when omnibox is selected, this routes to [BridgedContentView keyDown:].

The reason this bug exists is that (cmd + left arrow) gets processed by (1) before (2) has a chance to see it. There's no clean way to fix this since [NSWindow sendEvent:] returns void, which means we can't route there first and then see if the event is handled. We could theoretically rewrite all our sendEvent: overrides to return a BOOL, but that would be a very large amount of work.

Instead, the easiest way to fix this is to only allow (cmd + left arrow) when the firstResponder is a web contents, and the web contents has chosen not to process the event.



Project Member

Comment 3 by bugdroid1@chromium.org, Jun 14 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4c9d08451ef94d31e97f189343914cf5144ae5c4

commit 4c9d08451ef94d31e97f189343914cf5144ae5c4
Author: erikchen <erikchen@chromium.org>
Date: Thu Jun 14 17:04:08 2018

macOS: Fix [cmd + left arrow] not working in Omnibox.

After a recent refactor, [cmd + left arrow] would perform history navigation
instead of moving the cursor to the beginning of the Omnibox. This happens
because the processing for the hotkey [triggering history navigation] has higher
priority than the typical event handling flow.

The hotkeys [cmd + left arrow] and [cmd + right arrow] are special, and should
only trigger if the firstResponder is a WebContents, and the WebContents has
chosen not to process the event.

This CL removes handleExtraKeyboardShortcut:, which was dead code.

Bug:  852332 
Change-Id: Id03f5e22337a79d9ca4abfd20d995a8cf8976b2a
Reviewed-on: https://chromium-review.googlesource.com/1099648
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567315}
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/global_keyboard_shortcuts_mac.h
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/global_keyboard_shortcuts_mac.mm
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/global_keyboard_shortcuts_mac_browsertest.mm
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/ui/cocoa/browser_window_cocoa.mm
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.h
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/ui/cocoa/chrome_command_dispatcher_delegate.mm
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/ui/cocoa/chrome_event_processing_window.h
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/ui/cocoa/chrome_event_processing_window.mm
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/chrome/browser/ui/views/frame/browser_frame_mac.mm
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/ui/base/cocoa/command_dispatcher.h
[modify] https://crrev.com/4c9d08451ef94d31e97f189343914cf5144ae5c4/ui/base/cocoa/command_dispatcher.mm

Status: Fixed (was: Assigned)

Sign in to add a comment