<?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>269832</bug_id>
          
          <creation_ts>2024-02-20 23:37:52 -0800</creation_ts>
          <short_desc>setValidity of ElementInternals can&apos;t handle missing optional anchor parameter</short_desc>
          <delta_ts>2025-03-27 11:02:48 -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 17</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>154907</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter>jeripeier</reporter>
          <assigned_to name="Ryosuke Niwa">rniwa</assigned_to>
          <cc>akeerthi</cc>
    
    <cc>ashvayka</cc>
    
    <cc>cdumez</cc>
    
    <cc>karlcow</cc>
    
    <cc>lukas.spirig</cc>
    
    <cc>mike</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2015694</commentid>
    <comment_count>0</comment_count>
    <who name="">jeripeier</who>
    <bug_when>2024-02-20 23:37:52 -0800</bug_when>
    <thetext>Steps to reproduce:

1. Go to https://jsfiddle.net/3js69ngu/3/. You will find a custom web component imitating a checkbox form control.
2. Click on &quot;Submit Form&quot; in the &quot;Custom Checkbox&quot; section


Actual results:

- No validation message appears
- Console error: &quot;An invalid form control is not focusable.&quot;

There is the &quot;setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void;&quot; method to set the validity state of a custom component using ElementInternals. As per description, the &quot;anchor&quot; parameter, which is used as the anchor to display the validity message, is optional. However, in Firefox, the message is not displayed as long anchor parameter is not provided. The error message &quot;An invalid form control is not focusable.&quot; is not true, as the custom form component (see https://jsfiddle.net/3js69ngu/3/) is focusable. Providing the host of the component as parameter is not possible, as the anchor parameter element needs to be inside the shadow DOM.

Definition:
anchor – An HTMLElement which can be used by the user agent to report problems with this form submission.


Expected results:

Not passing an anchor should focus the host and display the message there. Check Chromium, where it is implemented and working like expected.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2016036</commentid>
    <comment_count>1</comment_count>
    <who name="">jeripeier</who>
    <bug_when>2024-02-22 02:57:22 -0800</bug_when>
    <thetext>Related specification discussion: https://github.com/whatwg/html/issues/10155</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2017409</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-02-27 23:38:14 -0800</bug_when>
    <thetext>&lt;rdar://problem/123744294&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2066954</commentid>
    <comment_count>3</comment_count>
    <who name="Lukas Spirig">lukas.spirig</who>
    <bug_when>2024-10-10 11:35:10 -0700</bug_when>
    <thetext>Has there been any progress with this?
Firefox has since addressed this: https://bugzilla.mozilla.org/show_bug.cgi?id=1881199</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2106311</commentid>
    <comment_count>4</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2025-03-26 17:43:52 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/43076</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2106501</commentid>
    <comment_count>5</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-03-27 11:02:45 -0700</bug_when>
    <thetext>Committed 292770@main (cdd7bac298f5): &lt;https://commits.webkit.org/292770@main&gt;

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

    </bug>

</bugzilla>