Consider merging https://chromium.googlesource.com/chromium/blink/+/b9834f34667cd0a4bee67fe702a915950dfb839a
In WebKit, form controls except text fields and <select> are not
mouse-focusable. This behavior is based on Cocoa native controls.
Though Firefox on Mac behaves same as WebKit, IE, Firefox (non-Mac),
and Opera(Presto) set focus by mouse press.
The WebKit behavior is not Web-compatible.
* Behavior change
We change the behavior so that mouse press sets focus to form controls
to improve web compatibility. However, We haven't set focus until now and
this behavior change might make existing users uncomfortable with focus
rings which appear on click. So, we don't draw focus rings if a form control
was focused by mouse press.
The main part of this CL is to remove HTMLFormControlElement::isMouseFocusable.
It means we use Node::isMouseFocusable, which is just isFocusable. We
can remove many isMouseFocusable implementations of
We change the followings to hide focus rings on mouse-focus:
- Introduce FocusDirectionMouse so that form control can distinguish
mouse focus from others.
- HTMLFormControlElement has m_wasFocusedByMouse flag. It is cleared
when a keydown event is delivered.
- Introduce HTMLFormControlElement::shouldShowFocusRingOnMouseFocus,
which represents differences between button controls and text/select
- RenderTheme, RenderObject, RenderInline don't draw focus rings if
We introduced Node::willCallDefaultEventHandler to re-show focus rings
after keyboard operations.
- Add many tests for new behavior.
- Remove fast/events/click-focus-control.html because now it is covered
by existing and new tests.
- Need rebaseline for afast/repaint/slider-thumb-float.html. We show
a focus ring for a control without -webkit-appearance.
Also merge https://chromium.googlesource.com/chromium/blink/+/543428b511b8fa108a740d2f707b10490dae20db
I’m pretty sure we have something to dupe this to.
Also see https://chromium.googlesource.com/chromium/blink/+/de021e8f7e23817680c5e1c3bfae93cda4556e27
> I’m pretty sure we have something to dupe this to.
And that something likely has a long discussion about why this is not desirable.
Another regression fix: http://src.chromium.org/viewvc/blink?revision=153039&view=revision
(In reply to comment #5)
> Another regression fix: http://src.chromium.org/viewvc/blink?revision=153039&view=revision
I mean https://chromium.googlesource.com/chromium/blink/+/ae238642883fd96e5ad4fa019ea13187dab4f5ae
(In reply to comment #6)
> (In reply to comment #5)
> I mean https://chromium.googlesource.com/chromium/blink/+/ae238642883fd96e5ad4fa019ea13187dab4f5ae
I recommend to merge Blink r159400 regardless of this bug. Blink r159400 is a general improvement of LABEL processing.
Coming in late as this caught me by complete surprise today ... that clicking with a mouse on a <button> does not set focus/fire the focus event on the <button>. This feels...extremely broken and unexpected.
I understand the rationale may be to "avoid visual clutter" (per https://bugs.webkit.org/show_bug.cgi?id=26856) but this sounds like an odd reason to break a fairly basic assumption on events/behavior.
Also, this is likely a dupe of https://bugs.webkit.org/show_bug.cgi?id=26856 ?
and probably related too https://bugs.webkit.org/show_bug.cgi?id=112968
and https://bugs.webkit.org/show_bug.cgi?id=92029 (sorry for flood of comments, but only unearthed these just now, as it seems to be a long-standing decision not to focus things)
(In reply to Patrick H. Lauke from comment #8)
> Coming in late as this caught me by complete surprise today ... that
> clicking with a mouse on a <button> does not set focus/fire the focus event
> on the <button>. This feels...extremely broken and unexpected.
> I understand the rationale may be to "avoid visual clutter" (per
> https://bugs.webkit.org/show_bug.cgi?id=26856) but this sounds like an odd
> reason to break a fairly basic assumption on events/behavior.
FWIW, I wouldn't take the opinion of a former Chrome engineer over a decade ago to have any bearing on WebKit today.
As discussed in bug 22261, Safari follows the macOS setting that controls whether non-text inputs are focusable, so that behaviour is similar between native apps and the web.
But yes, let's close this as a dupe.
*** This bug has been marked as a duplicate of bug 22261 ***