Commit caf6dca0 authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Don't claim BridgedContentView can't be first responder when it's first responder

BridgedContentView can and should be first responder when a browser chrome
element is focused, but was changed to always respond |NO| to
|acceptsFirstResponder| in https://chromium-review.googlesource.com/c/chromium/src/+/670479

This doesn't prevent it from being made first responder explicitly, but
is meant to prevent mouse-clicks on non-interactable chrome from stealing
focus from web content*

Unfortunately, when ordering a window in, if the window's first responder
claims not to accept first responder, AppKit finds one which will.
I don't think this is reproable in normal use, but it breaks some
interactive_ui_tests.

This change is a variation on a comment tapted@ made on the original CL.
Now, we only claim to accept first responder if we are already first
responder.

* Though I can't actually repro this by changing the method to always
return |YES|, so who knows.

Bug: 822824
Change-Id: I7ed3334f5ddd8ef9334acb13f6b6ea71529b0196
Reviewed-on: https://chromium-review.googlesource.com/971945
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544717}
parent bda3663a
......@@ -614,11 +614,16 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
// NSView implementation.
// Always refuse first responder. Note this does not prevent the view becoming
// first responder via -[NSWindow makeFirstResponder:] when invoked during Init
// or by FocusManager.
// Refuse first responder, unless we are already first responder. Note this does
// not prevent the view becoming first responder via -[NSWindow
// makeFirstResponder:] when invoked during Init or by FocusManager.
//
// The condition is to work around an AppKit quirk. When a window is being
// ordered front, if its current first responder returns |NO| for this method,
// it resigns it if it can find another responder in the key loop that replies
// |YES|.
- (BOOL)acceptsFirstResponder {
return NO;
return [[self window] firstResponder] == self;
}
- (BOOL)becomeFirstResponder {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment