<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>118043</bug_id>
          
          <creation_ts>2013-06-26 00:02:12 -0700</creation_ts>
          <short_desc>Mouse press should focus on any types of form controls</short_desc>
          <delta_ts>2021-05-17 02:52:07 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>22261</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BlinkMergeCandidate</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryosuke Niwa">rniwa</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>allan.jensen</cc>
    
    <cc>ap</cc>
    
    <cc>gsnedders</cc>
    
    <cc>jmjacobs</cc>
    
    <cc>jonlee</cc>
    
    <cc>lizmitchell</cc>
    
    <cc>priyajeet.hora</cc>
    
    <cc>redux</cc>
    
    <cc>syoichi</cc>
    
    <cc>tkent</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>903573</commentid>
    <comment_count>0</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-06-26 00:02:12 -0700</bug_when>
    <thetext>Consider merging https://chromium.googlesource.com/chromium/blink/+/b9834f34667cd0a4bee67fe702a915950dfb839a

* Background
In WebKit, form controls except text fields and &lt;select&gt; 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&apos;t set focus until now and
this behavior change might make existing users uncomfortable with focus
rings which appear on click. So, we don&apos;t draw focus rings if a form control
was focused by mouse press.

* Implementation
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
HTMLFormControlElement subclasses.

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
    controls.
 - RenderTheme, RenderObject, RenderInline don&apos;t draw focus rings if
    conditions match.

We introduced Node::willCallDefaultEventHandler to re-show focus rings
after keyboard operations.

Test changes:
 - 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>916490</commentid>
    <comment_count>1</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-08-12 19:18:09 -0700</bug_when>
    <thetext>Also merge https://chromium.googlesource.com/chromium/blink/+/543428b511b8fa108a740d2f707b10490dae20db</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>916766</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2013-08-13 09:56:23 -0700</bug_when>
    <thetext>I’m pretty sure we have something to dupe this to.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>922619</commentid>
    <comment_count>3</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-08-29 13:06:44 -0700</bug_when>
    <thetext>Also see https://chromium.googlesource.com/chromium/blink/+/de021e8f7e23817680c5e1c3bfae93cda4556e27</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>923109</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2013-08-30 11:38:18 -0700</bug_when>
    <thetext>&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>948128</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-11-07 01:12:26 -0800</bug_when>
    <thetext>Another regression fix: http://src.chromium.org/viewvc/blink?revision=153039&amp;view=revision</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>948129</commentid>
    <comment_count>6</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2013-11-07 01:12:36 -0800</bug_when>
    <thetext>(In reply to comment #5)
&gt; Another regression fix: http://src.chromium.org/viewvc/blink?revision=153039&amp;view=revision

I mean https://chromium.googlesource.com/chromium/blink/+/ae238642883fd96e5ad4fa019ea13187dab4f5ae</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>948422</commentid>
    <comment_count>7</comment_count>
    <who name="Kent Tamura">tkent</who>
    <bug_when>2013-11-07 14:25:44 -0800</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #5)
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1677223</commentid>
    <comment_count>8</comment_count>
    <who name="Patrick H. Lauke">redux</who>
    <bug_when>2020-08-02 11:33:11 -0700</bug_when>
    <thetext>Coming in late as this caught me by complete surprise today ... that clicking with a mouse on a &lt;button&gt; does not set focus/fire the focus event on the &lt;button&gt;. This feels...extremely broken and unexpected.

I understand the rationale may be to &quot;avoid visual clutter&quot; (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 ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1677224</commentid>
    <comment_count>9</comment_count>
    <who name="Patrick H. Lauke">redux</who>
    <bug_when>2020-08-02 12:08:17 -0700</bug_when>
    <thetext>and probably related too https://bugs.webkit.org/show_bug.cgi?id=112968</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1677225</commentid>
    <comment_count>10</comment_count>
    <who name="Patrick H. Lauke">redux</who>
    <bug_when>2020-08-02 12:11:17 -0700</bug_when>
    <thetext>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)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1760703</commentid>
    <comment_count>11</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2021-05-17 02:52:07 -0700</bug_when>
    <thetext>(In reply to Patrick H. Lauke from comment #8)
&gt; Coming in late as this caught me by complete surprise today ... that
&gt; clicking with a mouse on a &lt;button&gt; does not set focus/fire the focus event
&gt; on the &lt;button&gt;. This feels...extremely broken and unexpected.
&gt; 
&gt; I understand the rationale may be to &quot;avoid visual clutter&quot; (per
&gt; https://bugs.webkit.org/show_bug.cgi?id=26856) but this sounds like an odd
&gt; reason to break a fairly basic assumption on events/behavior.

FWIW, I wouldn&apos;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&apos;s close this as a dupe.

*** This bug has been marked as a duplicate of bug 22261 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>