<?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>244240</bug_id>
          
          <creation_ts>2022-08-23 00:57:02 -0700</creation_ts>
          <short_desc>Mouse wheel behavior on &lt;input type=&quot;number&quot;&gt; is changed by other elements with wheel event handler</short_desc>
          <delta_ts>2025-01-23 05:51:11 -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>WebKit2</component>
          <version>Safari 15</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=42441</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>azuma.ginkakuji</reporter>
          <assigned_to name="Anne van Kesteren">annevk</assigned_to>
          <cc>50167214</cc>
    
    <cc>akeerthi</cc>
    
    <cc>annevk</cc>
    
    <cc>azuma.ginkakuji</cc>
    
    <cc>cdumez</cc>
    
    <cc>dholbert</cc>
    
    <cc>karlcow</cc>
    
    <cc>kkinnunen</cc>
    
    <cc>ntim</cc>
    
    <cc>rniwa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1893183</commentid>
    <comment_count>0</comment_count>
    <who name="">azuma.ginkakuji</who>
    <bug_when>2022-08-23 00:57:02 -0700</bug_when>
    <thetext>Steps to reproduce problem

1. Open https://jsfiddle.net/ytfh4r2k/
2. Focus the first input field and move mouse pointer on it.
3. Turn the mouse wheel on the first input field.
4. Then, focus the second input field and move mouse pointer on it.
5. Turn the mouse wheel on the second input field.

Actual: Each input field behaves differently: the value of the first input field changes but the value of the second input field doesn&apos;t change.
Expected: Both input fields behave in the same way.

I think it is strange that the wheel behavior changes by an event handler of not-self nor not-ancestor elements.

It behaves as expected in Firefox. Chrome behaves as the same as Safari. https://bugs.chromium.org/p/chromium/issues/detail?id=1355750</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1893269</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-08-23 10:34:52 -0700</bug_when>
    <thetext>Reproduces with trackpad too. Also reproduces in Chrome.

This is strange indeed, TextFieldInputType::shouldSpinButtonRespondToWheelEvents() is a very simple function.

I think that this isn&apos;t even a DOM issue, but we probably short circuit these wheel events in UI process. Both input fields respect wheel/scroll events in WebKit1, and the bug only reproduces with WebKit2. It&apos;s curious that Chrome appears to have an identical one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1894734</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-08-30 00:57:16 -0700</bug_when>
    <thetext>&lt;rdar://problem/99318505&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897143</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-09-08 16:43:34 -0700</bug_when>
    <thetext>This is happening because the &lt;p&gt; with the wheel event handler is creating an event region, so we send wheel events to the main thread.

What we should be doing is to add &lt;input type=&quot;number&quot;&gt; to the wheel event region, like we do for &lt;select&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2077832</commentid>
    <comment_count>4</comment_count>
    <who name="yisibl">50167214</who>
    <bug_when>2024-11-26 23:15:32 -0800</bug_when>
    <thetext>This case also reproduces the problem.

```html
data:text/html;charset=UTF-8,&lt;!DOCTYPE html&gt;&lt;input type=&quot;number&quot; value=&quot;1&quot; onwheel=&quot;&quot; /&gt;
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2084303</commentid>
    <comment_count>5</comment_count>
    <who name="Daniel Holbert">dholbert</who>
    <bug_when>2024-12-30 17:04:38 -0800</bug_when>
    <thetext>(In reply to Simon Fraser (smfr) from comment #3)
&gt; What we should be doing is to add &lt;input type=&quot;number&quot;&gt; to the wheel event
&gt; region, like we do for &lt;select&gt;

You might not actually want to do that; I think that&apos;s what Firefox was doing, but it resulted in number-input-fields being unintentionally mutated. Screencast to demonstrate that:
https://bugzilla.mozilla.org/attachment.cgi?id=9252014

I switched off our implementation of this wheel-mutation-behavior entirely in https://bugzilla.mozilla.org/show_bug.cgi?id=1741469 as a result of that footgun.  We now have https://bugzilla.mozilla.org/show_bug.cgi?id=1939377 filed to consider reenabling it with some sort of opt-in mechanism (possibly checking for `wheel` event-listener as Chrome/Safari do now, perhaps unintentionally).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2085113</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2025-01-06 10:57:49 -0800</bug_when>
    <thetext>Thanks for the heads-up!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2085252</commentid>
    <comment_count>7</comment_count>
    <who name="Daniel Holbert">dholbert</who>
    <bug_when>2025-01-06 16:03:44 -0800</bug_when>
    <thetext>(In reply to Daniel Holbert from comment #5)
&gt; (In reply to Simon Fraser (smfr) from comment #3)
&gt; &gt; What we should be doing is to add &lt;input type=&quot;number&quot;&gt; to the wheel event
&gt; &gt; region, like we do for &lt;select&gt;
&gt; 
&gt; You might not actually want to do that; I think that&apos;s what Firefox was
&gt; doing, but it resulted in number-input-fields being unintentionally mutated.
&gt; Screencast to demonstrate that:
&gt; https://bugzilla.mozilla.org/attachment.cgi?id=9252014

Sorry, that^ screencast wasn&apos;t super-great at illustrating the problem. Here&apos;s a better one:
https://bug1741469.bmoattachments.org/attachment.cgi?id=9445963
(This is using this testcase: https://bug1741469.bmoattachments.org/attachment.cgi?id=9445961 , with the wheel-mutation-behavior toggled back on as shown at the start of the screencast.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087250</commentid>
    <comment_count>8</comment_count>
    <who name="Daniel Holbert">dholbert</who>
    <bug_when>2025-01-14 15:21:35 -0800</bug_when>
    <thetext>Historical note -- this may have been a regression in WebKit at some point. Safari 5.1 matches the permissive behavior that Firefox recently had -- i.e. focused number fields were mutable via mousewheel scrolling, without any special event listener needed.  I confirmed that using this testcase:
```
data:text/html,&lt;input type=&quot;number&quot; value=&quot;0&quot;&gt;
```
I can mousewheel-scroll to change the value in that testcase (after focusing the field), using BrowserStack to test Safari 5.1 on Snow Leopard, and Safari 5.1 &amp; 6.0.5 on Lion. 

However, Safari 6.2 on Mountain Lion and 7.1 on Mavericks both behave like current Safari, where they need the `wheel` event-listener in order for the number field to be mutated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087257</commentid>
    <comment_count>9</comment_count>
    <who name="Daniel Holbert">dholbert</who>
    <bug_when>2025-01-14 15:42:59 -0800</bug_when>
    <thetext>See also https://github.com/whatwg/html/issues/10911 where we&apos;re suggesting that this opt-in mechanism be standardized in some way, possibly using a `wheel` event listener for backwards-compatibility with the behavior that Chrome &amp; Safari are currently shipping (which some sites have come to rely on).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088988</commentid>
    <comment_count>10</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2025-01-22 08:16:45 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/39382</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088989</commentid>
    <comment_count>11</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2025-01-22 08:17:28 -0800</bug_when>
    <thetext>Given the feedback on the HTML issue and the fact that this doesn&apos;t actually match Apple platforms I have put up a patch to remove this functionality completely.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2089250</commentid>
    <comment_count>12</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-01-23 05:51:08 -0800</bug_when>
    <thetext>Committed 289285@main (03828826a1c3): &lt;https://commits.webkit.org/289285@main&gt;

Reviewed commits have been landed. Closing PR #39382 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>