<?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>261945</bug_id>
          
          <creation_ts>2023-09-22 06:48:56 -0700</creation_ts>
          <short_desc>iOS 17 &gt; &lt;button /&gt; inner &lt;form /&gt; can&apos;t summon popover element.</short_desc>
          <delta_ts>2024-08-27 23:43:51 -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>DOM</component>
          <version>Safari 17</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>iOS 17</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>275899</dup_id>
          
          <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="Paul Li">meistudioli</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>alec_g</cc>
    
    <cc>johanroed</cc>
    
    <cc>jxck</cc>
    
    <cc>leevi</cc>
    
    <cc>lwarlow</cc>
    
    <cc>ntim</cc>
    
    <cc>pimento_trolls.0a</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1979337</commentid>
    <comment_count>0</comment_count>
      <attachid>467824</attachid>
    <who name="Paul Li">meistudioli</who>
    <bug_when>2023-09-22 06:48:56 -0700</bug_when>
    <thetext>Created attachment 467824
test case

Safari Version       : 17
OS                   : iOS


Steps to reproduce the problem
1. put a &lt;button type=&quot;button&quot; /&gt; inner a &lt;form /&gt; and set popovertarget.
2. press the button and expect popover element popup.

What is the expected behavior?
1. popover element popup.

What went wrong?
1. popover element doesn&apos;t popup.


Sample code (attachment):
&lt;style&gt;
#my-popover {
  inset: 0;
  padding: 32px;
  border-radius: 16px;
  margin: auto;
}
&lt;/style&gt;

&lt;form&gt;
  &lt;button type=&quot;button&quot; popovertarget=&quot;my-popover&quot;&gt;tap me&lt;/button&gt;
&lt;/form&gt;
&lt;div id=&quot;my-popover&quot; popover&gt;I am popover&lt;/div&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1979483</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Nguyen (:ntim)">ntim</who>
    <bug_when>2023-09-22 15:39:05 -0700</bug_when>
    <thetext>I suspect WebKit is hitting the submit button check: https://searchfox.org/wubkat/rev/f20a3ce20e867a081396437e684de72bf8d52320/Source/WebCore/html/HTMLFormControlElement.cpp#362-363

even though it&apos;s not a submit button in the testcase. Needs investigation</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1981258</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-09-29 06:49:14 -0700</bug_when>
    <thetext>&lt;rdar://problem/116235346&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2010749</commentid>
    <comment_count>3</comment_count>
    <who name="johan">johanroed</who>
    <bug_when>2024-02-05 11:47:06 -0800</bug_when>
    <thetext>This is a blocker for adoption of the HTML popover API (which was introduced in by Safari in 17.0). 

Popovers as popup-tips /tooltips related form input is a very common use case for a popup, from the MDN docs `Typical use cases for the popover API include user-interactive elements like action menus, custom &quot;toast&quot; notifications, form element suggestions, content pickers, or teaching UI.`:

```html
&lt;form&gt;
  &lt;label for=&quot;issue&quot;&gt;Issue number&lt;/label&gt;&lt;button type=&quot;button&quot; popovertarget=&quot;popover-tip&quot;&gt;?&lt;/button&gt;
  &lt;div popover=&quot;auto&quot; id=&quot;popover-tip&quot;&gt;You can find the issue number in the url, for example &quot;261945&quot; in https://bugs.webkit.org/show_bug.cgi?id=261945&lt;/div&gt;
  &lt;input type=&quot;text&quot; name=&quot;issue&quot;/&gt;
  &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;
&lt;/form&gt;
```

The spec does only mentions `If node has a form owner and node is a submit button, then return null.`. Hopefully this is a very simple check gone wrong. Excited for any updates on this!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2010765</commentid>
    <comment_count>4</comment_count>
    <who name="johan">johanroed</who>
    <bug_when>2024-02-05 12:10:46 -0800</bug_when>
    <thetext>`&lt;input type=&quot;button&quot;&gt;` does not seem to have the same limitations, and could be a workaround for some until the spec is followed for `&lt;button type=&quot;button&quot;&gt;`</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2019937</commentid>
    <comment_count>5</comment_count>
    <who name="Thomas Cannon">pimento_trolls.0a</who>
    <bug_when>2024-03-10 10:01:17 -0700</bug_when>
    <thetext>See the following codeine as well: https://codepen.io/Penote/pen/ExrOwwd</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2029395</commentid>
    <comment_count>6</comment_count>
    <who name="Jxck">jxck</who>
    <bug_when>2024-04-18 01:25:24 -0700</bug_when>
    <thetext>Same problem here.

I have use-case like below.

- if user has permission, user can submit form
- otherwise, show popover

Do it like below.

```html
&lt;form&gt;
  &lt;h1&gt;&lt;label&gt;popover DEMO&lt;/label&gt;&lt;/h1&gt;
  &lt;textarea id=&quot;anchor&quot; name=&quot;body&quot;&gt;&lt;/textarea&gt;
  &lt;div id=&quot;popover&quot; anchor=&quot;anchor&quot; popover&gt;
    &lt;p&gt;you dont have permission&lt;/p&gt;
  &lt;/div&gt;
  &lt;button type=&quot;button&quot; popovertarget=&quot;popover&quot;&gt;ok&lt;/button&gt;
&lt;/form&gt;
```

It intended to switch `button[type=submit]` for submit form, otherwise, make it `button[type=button]` for avoid submitting and show popover.

It works as expected in chrome &amp; firefox. but not in safari.

DEMO: https://labs.jxck.io/popover/form.html

happy to see it works.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2044539</commentid>
    <comment_count>7</comment_count>
    <who name="Alec">alec_g</who>
    <bug_when>2024-07-03 14:30:21 -0700</bug_when>
    <thetext>I have also encountered this and want to highlight that is also occurs in Safari 17.5 on macOS. I hope we can get a fix.

A workaround suitable for some situations is to place the triggering button (and other form controls as required) outside of the form.

For example this non-working nested form

&lt;form id=&quot;nested&quot;&gt;
  &lt;input type=&quot;text&quot; /&gt;
  &lt;button popovertarget=&quot;mypopover-2&quot; type=&quot;button&quot;&gt;More info&lt;/button&gt;
  &lt;div id=&quot;mypopover-2&quot; popover&gt;Popover Two content&lt;/div&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;button type=&quot;submit&quot;&gt;Submit form&lt;/button&gt;
&lt;/form&gt;

can be made to work if re-written in non-nested form:

&lt;form id=&quot;non-nested&quot;&gt;&lt;/form&gt;
&lt;input type=&quot;text&quot; form=&quot;non-nested&quot; /&gt;
&lt;button popovertarget=&quot;mypopover-3&quot; type=&quot;button&quot;&gt;More info&lt;/button&gt;
&lt;div id=&quot;mypopover-3&quot; popover&gt;Popover Three content&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
&lt;button type=&quot;submit&quot; form=&quot;non-nested&quot;&gt;Submit form&lt;/button&gt;

As the form is no longer nested, each control needs to reference the form by id using the form attribute.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2052903</commentid>
    <comment_count>8</comment_count>
    <who name="Leevi">leevi</who>
    <bug_when>2024-08-14 20:15:35 -0700</bug_when>
    <thetext>This issue is also in WebKit 19619.1.22.5 (Safari 18.0, Release 199)

&lt;form&gt;
&lt;button type=&quot;button&quot; popovertarget=&quot;test&quot;&gt;Pop not a form&lt;/button&gt;
&lt;div id=&quot;test&quot; popover&gt;Test&lt;/div&gt;
&lt;/form&gt;

&lt;button type=&quot;button&quot; popovertarget=&quot;test2&quot;&gt;Pop not a form&lt;/button&gt;
&lt;div id=&quot;test2&quot; popover&gt;Test2&lt;/div&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2053204</commentid>
    <comment_count>9</comment_count>
    <who name="Leevi">leevi</who>
    <bug_when>2024-08-15 21:06:46 -0700</bug_when>
    <thetext>Related issue: https://bugs.webkit.org/show_bug.cgi?id=275899

PR to fix issue: https://github.com/WebKit/WebKit/pull/30187</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2055660</commentid>
    <comment_count>10</comment_count>
    <who name="Luke Warlow">lwarlow</who>
    <bug_when>2024-08-27 08:50:10 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 275899 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>467824</attachid>
            <date>2023-09-22 06:48:56 -0700</date>
            <delta_ts>2023-09-22 06:48:56 -0700</delta_ts>
            <desc>test case</desc>
            <filename>ios17_safari_popover.html</filename>
            <type>text/html</type>
            <size>231</size>
            <attacher name="Paul Li">meistudioli</attacher>
            
              <data encoding="base64">PHN0eWxlPgojbXktcG9wb3ZlciB7CiAgaW5zZXQ6IDA7CiAgcGFkZGluZzogMzJweDsKICBib3Jk
ZXItcmFkaXVzOiAxNnB4OwogIG1hcmdpbjogYXV0bzsKfQo8L3N0eWxlPgoKPGZvcm0+CiAgPGJ1
dHRvbiB0eXBlPSJidXR0b24iIHBvcG92ZXJ0YXJnZXQ9Im15LXBvcG92ZXIiPnRhcCBtZTwvYnV0
dG9uPgo8L2Zvcm0+CjxkaXYgaWQ9Im15LXBvcG92ZXIiIHBvcG92ZXI+SSBhbSBwb3BvdmVyPC9k
aXY+
</data>

          </attachment>
      

    </bug>

</bugzilla>