[Webkit-unassigned] [Bug 261432] New: Form associated ElementInternals always reports customError when using setValidity

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 11 14:42:36 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=261432

            Bug ID: 261432
           Summary: Form associated ElementInternals always reports
                    customError when using setValidity
           Product: WebKit
           Version: Safari 16
          Hardware: Mac (Apple Silicon)
                OS: macOS 13
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Forms
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: lizmitchell at google.com
                CC: cdumez at apple.com, wenson_hsieh at apple.com

A form associated custom element can call `internals.setValidity(flags)`. If `customError` is missing or set to `false` in the flags, `internals.validity.customError` always reports true, as long as one of the validity flags is set to true.

```
<script>
  class XControl extends HTMLElement {
    static formAssociated = true;

    constructor() {
      super();
      this.internals = this.attachInternals();
      this.internals.setValidity({valueMissing: true, customError: false}, 'Value missing');
      // Expecting "customError: false"
      alert(`customError: ${this.internals.validity.customError}`);
    }
  }

  customElements.define('x-control', XControl);
</script>
<x-control></x-control>
```

Repro: https://jsbin.com/nodibatala/edit?html,output

Expectation: open the repro and get an alert of "customError: false". This works in Chrome and Firefox

Actual: Safari 16.6 reports "customError: true", even when customError is set to false.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230911/1477f87d/attachment.htm>


More information about the webkit-unassigned mailing list