Skip to content

Attempting to set ARIA properties on ElementInternals results in an error. #3732

Description

@zzzzBov

Basic info:

Attempting to assign ARIA properties on ElementInternals for custom elements results in an error:

Error: Uncaught [TypeError: Cannot read properties of undefined (reading 'set')]
  • Node.js version: 21.6.2
  • jsdom version: 24.1.0

Minimal reproduction case

const { JSDOM } = require("jsdom");

new JSDOM(
  `
<!DOCTYPE html>
<title></title>
<script>
class ExampleElement extends HTMLElement {
  constructor() {
    super();

    const internals = this.attachInternals();
    internals.role = 'button';
  }
}
customElements.define('example-element', ExampleElement);
</script>
<example-element></example-element>
`,
  {
    runScripts: "dangerously",
  }
);

How does similar code behave in browsers?

CodePen example

Metadata

Metadata

Assignees

No one assigned

    Labels

    metr upliftA candidate for the METR Uplift experiment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions