<?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>235911</bug_id>
          
          <creation_ts>2022-01-31 13:19:50 -0800</creation_ts>
          <short_desc>Select on iPad doesn&apos;t refresh dropdown UI after an option is removed</short_desc>
          <delta_ts>2023-12-09 07:48:29 -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>Forms</component>
          <version>Safari 15</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 15</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Critical</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</reporter>
          <assigned_to name="Aditya Keerthi">akeerthi</assigned_to>
          <cc>akeerthi</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>michael</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1835663</commentid>
    <comment_count>0</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-01-31 13:19:50 -0800</bug_when>
    <thetext>This is an issue reported as happening in the wild on a project using AngularJS. AngularJS is EOL now and will not see a new release. Unless iPad Safari is fixed, this will forever stay broken in the official AngularJS.

On an iPad with the latest iPadOS 15.3, if you have a `&lt;select&gt;` element on the page and you perform the following steps:
1. Open the select dropdown by clicking on it (then optionally close it, it doesn&apos;t matter)
2. Programmatically remove an option by invoking `select.remove(0)`
3. Open the select dropdown again
you&apos;ll see that the dropdown still shows all the original options despite the select DOM being properly updated.

When that issue happens, it&apos;s sometimes very hard to force Safari to update the UI state properly. Opening the same select dropdown repeatedly doesn&apos;t update it. Some CSS actions like setting the select height help but only if the dropdown is opened after this height update so programmatic workarounds like &quot;set select height to 10px, force style recalc, reset select height&quot; don&apos;t work. If you have multiple select elements on the page and you open another one, the UI state cache is apparently cleared and opening the first select now shows the correct options. Again, this is not something that can be done programmatically by a library.

Weirdly, this only happens on iPad. It works fine on macOS &amp; on an iPhone. On an iPad, it happens both on a real device (tested on iPad 9th generation) on iPadOS 15.3 and on an iPad Pro (11-inch) simulator with iPadOS 15.2. I was also able to reproduce on an iPadOS 14.5 simulator but not on the iPadOS 13.5 one.


A live test case: Test case showing the issue: https://output.jsbin.com/fihujuq/8.

The AngularJS issue: https://github.com/angular/angular.js/issues/17168</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1835672</commentid>
    <comment_count>1</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-01-31 13:23:20 -0800</bug_when>
    <thetext>There&apos;s an older related issue:
https://bugs.webkit.org/show_bug.cgi?id=128721
However, that one is quite old and it affected both iPhone &amp; iPad. Plus, as I mentioned, I cannot reproduce the issue I now reported on iPad 13.5 so it seems to be a new issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1835709</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-01-31 14:01:17 -0800</bug_when>
    <thetext>&lt;rdar://problem/88292987&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1835744</commentid>
    <comment_count>3</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-01-31 15:18:19 -0800</bug_when>
    <thetext>I&apos;ll add that when the outdated UI appears with the first option still present, clicking on the second visible option will activate the second real option in the select - which is a different one.

For example, if you have options:
* empty
* A
* B

and you remove the first empty option, hitting the issue and then open the dropdown &amp; choose &quot;A&quot;, it will actually select &quot;B&quot; as that&apos;s what&apos;s under index 1 at the moment. It&apos;s not just a visual quirk, it creates a really broken behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1835756</commentid>
    <comment_count>4</comment_count>
    <who name="Aditya Keerthi">akeerthi</who>
    <bug_when>2022-01-31 16:07:13 -0800</bug_when>
    <thetext>I think this issue is due to the fact that, specifically on iPad, &lt;select&gt; elements are not blurred when the dropdown is dismissed. The options themselves are populated when the element is focused, so the state is inconsistent. 

A workaround would be to blur the element before/after changing the options (via select.blur()).

To fix in WebKit, I think we&apos;ll need to trigger a FocusedElementInformation update when options are changed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1841077</commentid>
    <comment_count>5</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-02-13 14:23:01 -0800</bug_when>
    <thetext>Blurring is quite invasive and I imagine it may have accessibility consequences. Is there a workaround that&apos;s less user hostile?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1857676</commentid>
    <comment_count>6</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-04-03 03:34:35 -0700</bug_when>
    <thetext>Any additional info? Any workarounds that are not as invasive? This is a pretty serious issue for any AngularJS app using selects...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1902821</commentid>
    <comment_count>7</comment_count>
    <who name="Michał Gołębiowski-Owczarek">m.goleb+bugzilla</who>
    <bug_when>2022-10-03 05:42:41 -0700</bug_when>
    <thetext>Any updates? This continues to be an issue in the latest stable iPad OS 15.x and there&apos;s no good workaround.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1998005</commentid>
    <comment_count>8</comment_count>
    <who name="Aditya Keerthi">akeerthi</who>
    <bug_when>2023-12-08 08:42:02 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/21504</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1998321</commentid>
    <comment_count>9</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-12-09 07:48:26 -0800</bug_when>
    <thetext>Committed 271805@main (cb12141f93d1): &lt;https://commits.webkit.org/271805@main&gt;

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

    </bug>

</bugzilla>