<?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>238093</bug_id>
          
          <creation_ts>2022-03-18 13:46:22 -0700</creation_ts>
          <short_desc>preventScroll does not work with dynamically created elements</short_desc>
          <delta_ts>2024-05-03 05:13:22 -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>Safari 15</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>macOS 11</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=267051</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 name="Elliot Nahman">Elliot.nahman</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>augus.dupin</cc>
    
    <cc>caleb</cc>
    
    <cc>cdumez</cc>
    
    <cc>rik</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>1852818</commentid>
    <comment_count>0</comment_count>
    <who name="Elliot Nahman">Elliot.nahman</who>
    <bug_when>2022-03-18 13:46:22 -0700</bug_when>
    <thetext>Safari 15 appears to have implemented the preventScroll option for Element.focus(). See the resolved webkit bug: https://bugs.webkit.org/show_bug.cgi?id=178583. 

While this feature works fine for elements already existing in the DOM, it does not work for dynamically added elements. 

Please see: https://codepen.io/nonmetalhail/pen/KKZzagd</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1852820</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-03-18 13:52:27 -0700</bug_when>
    <thetext>Thanks for the report. I can reproduce.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1852821</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-03-18 13:52:39 -0700</bug_when>
    <thetext>&lt;rdar://problem/90502768&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1852830</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-03-18 14:12:36 -0700</bug_when>
    <thetext>In the bad case we&apos;re scrolling via FrameSelection::updateAppearanceAfterLayoutOrStyleChange().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1852833</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-03-18 14:17:42 -0700</bug_when>
    <thetext>Layout calls FrameSelection::setNeedsSelectionUpdate() which resets m_selectionRevealMode to SelectionRevealMode::Reveal here:

    if (innerTextSizeChanged &amp;&amp; frame().selection().isFocusedAndActive() &amp;&amp; document().focusedElement() == &amp;inputElement()) {
        // The caps lock indicator was hidden or shown. If it is now visible then it may be occluding
        // the current selection (say, the caret was after the last character in the text field).
        // Schedule an update and reveal of the current selection.
        frame().selection().setNeedsSelectionUpdate(FrameSelection::RevealSelectionAfterUpdate::Forced);
    }

This is trying to ensure that text within the input is scrolled into view, but has the side effect of also triggering page scrolling.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>