<?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>158517</bug_id>
          
          <creation_ts>2016-06-07 23:42:17 -0700</creation_ts>
          <short_desc>:hover is sticky on iOS, even on touch-friendly webpages</short_desc>
          <delta_ts>2022-02-08 23:23:43 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>Safari 9</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 10</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.chromium.org/p/chromium/issues/detail?id=370155</see_also>
          <bug_file_loc>http://jsbin.com/nepisob/edit?html,css,output</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>HasReduction, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>159753</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Rebert">webkit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>benjamin</cc>
    
    <cc>bfulgham</cc>
    
    <cc>nekr.fabula</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1200357</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Rebert">webkit</who>
    <bug_when>2016-06-07 23:42:17 -0700</bug_when>
    <thetext>Steps to reproduce:
1. Open http://output.jsbin.com/nepisob/quiet in iOS 9.3.2 Safari.
2. Tap the cyan &quot;H&quot; button.
3. Ensure your fingers are no longer touching the screen.

Expected result:
The &quot;H&quot; button should be cyan.

Actual result:
The &quot;H&quot; button is red,
indicating that the :hover pseudo-class is still matching.

Sampling of original Bootstrap issues:
* https://github.com/twbs/bootstrap/issues/10828
* https://github.com/twbs/bootstrap/issues/12692
* https://github.com/twbs/bootstrap/issues/12832

Related radars:
&lt;rdar://problem/15100108&gt;

See also:
https://bugs.chromium.org/p/chromium/issues/detail?id=370155

Details:
Mobile WebKit makes the :hover CSS pseudo-class &quot;sticky&quot;
(i.e. continue to match a tapped element until another clickable element gets tapped)
in order to accommodate legacy webpages which were only designed with desktop browsers in mind
and thus have e.g. menus or tooltips which only appear on hover. Without this stickiness,
since touch devices don&apos;t typically physically support a real hovering interaction,
such widgets would frustrating or impossible for users on touch devices to deal with.
Making :hover sticky on such pages is perfectly reasonable.

However, modern webpages are usually designed to account for mobile/touch devices,
and thus avoid critical hover-only interactions. Many such pages are mobile-first rather
than mobile-only, and thus wish to still use :hover (correctly) to slightly enhance the
experience of desktop users. The typical example is wanting to change a button&apos;s styling
on :hover, as an affordance to indicate that it&apos;s an interactive button.
However, :hover stickiness causes the buttons on these webpages to get stuck in
a hovered/selected state after a tap on them has completed,
thus confusing the user (and frustrating designers).

Currently, the only decent known workaround is to use a JS library such as
what-input (https://github.com/ten1seven/what-input , http://ten1seven.github.io/what-input/ )
to track the user&apos;s input modality, and make all :hover styles conditional upon a mouse modality.
This adds an extra JS dependency, adds a CSS build step (or requires constant discipline when authoring CSS),
and may not be robust to the future addition of more input modalities to the Web® Platform™.
It is thus a very suboptimal workaround.

Therefore, it would be nice if there was some mechanism for webpages to opt out of sticky :hover.
(e.g. Perhaps rules similar to those that enable fast-tapping; https://webkit.org/blog/5610/more-responsive-tapping-on-ios/ )</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1203222</commentid>
    <comment_count>1</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2016-06-16 22:37:22 -0700</bug_when>
    <thetext>I don&apos;t think we can easily fix :hover because of legacy content.

IMHO, &quot;:active&quot; should match elements under the primary touch point. It also makes more sense with the existing specs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1203228</commentid>
    <comment_count>2</comment_count>
    <who name="Chris Rebert">webkit</who>
    <bug_when>2016-06-16 23:14:53 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; I don&apos;t think we can easily fix :hover because of legacy content.

I don&apos;t understand why you&apos;re citing legacy content as a reason, when the suggestion
is specifically to *not* change the semantics for legacy content.
Only non-legacy content would be affected.

&gt; IMHO, &quot;:active&quot; should match elements under the primary touch point.

Personally, I would be equally fine with having :hover never apply when using touch input on non-legacy webpages.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1203362</commentid>
    <comment_count>3</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2016-06-17 11:47:46 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (In reply to comment #1)
&gt; &gt; I don&apos;t think we can easily fix :hover because of legacy content.
&gt; 
&gt; I don&apos;t understand why you&apos;re citing legacy content as a reason, when the
&gt; suggestion
&gt; is specifically to *not* change the semantics for legacy content.
&gt; Only non-legacy content would be affected.

We could certainly have the behavior of :hover change depending on the viewport meta tag or other signals that a page is mobile friendly. I generally try to avoid &quot;modes of operations&quot; like that and prefer to have a consistent behavior.

I was not rejecting your idea of getting rid of :hover for mobile. Just giving my opinion on how I would prefer the use case to be handled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1839032</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-02-08 23:23:43 -0800</bug_when>
    <thetext>&lt;rdar://problem/88673998&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>