Closed Bug 1895551 Opened 10 months ago Closed 9 months ago

Setting Null on ElementInternals attributes does not remove attribute

Categories

(Core :: Disability Access APIs, defect)

defect

Tracking

()

RESOLVED FIXED
128 Branch
Tracking Status
firefox128 --- fixed

People

(Reporter: eeejay, Assigned: eeejay)

References

Details

Attachments

(1 file)

Given:

<custom-slider></custom-slider>
<script>
customElements.define(`custom-slider`,
    class extends HTMLElement {
      constructor() {
        super();
        this._internals = this.attachInternals();
        this._internals.role = slider;
        this._internals.ariaValueNow = "5";
        this._internals.ariaValueMin = "1";
        this._internals.ariaValueMax = "10";
        this._internals.ariaValueText = null;
      }
    }
  );
</script>

The expected value would be "5", but it is "". This is because ElementInternals does not treat null values correctly and considers the ariaValueText attribute to be set.

While we could fix this in a11y by distinguishing between a null and empty string attribute, I would argue that the correct remedy is that the attribute should be unset in the internals when null is passed. This is the same behavior in Element.

FWIW, we originally had the same bug in Element, bug 1853209. That was definitely contrary to the spec.

See Also: → 1853209
Severity: -- → S3
Pushed by eisaacson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/820577191451 Remove aria attribute from ElementInternals when set to null. r=Jamie,dom-core,edgar
Status: NEW → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 128 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: