Skip to content

Shadow DOM and ElementInternals ARIAMixin properties #8544

Open
@alice

Description

@alice

This came out of the discussion on #8442.

Do Element/FrozenArray<Element> attributes on ElementInternals need to be subject to the same Shadow DOM validation rules as the same IDL attributes on Elements?

For example:

<my-listbox>
  # shadowRoot
  | <my-listitem>Generated option 1</my-listitem>
  | <my-listitem>Generated option 2</my-listitem>
  | <my-listitem>Generated option 3</my-listitem>
</my-autocomplete>
class MyListbox extends HTMLElement {
  constructor() {
    super();
    this._internals = this.attachInternals();
    this._internals.role = "listbox";
    // etc
  }

  // ...

  // called when a user selects a list item via mouse or keyboard
  listItemSelected(selectedListItem) {
    // not allowed:
    // this.ariaActiveDescendantElement = selectedListItem;

    // allowed?
    this._internals.ariaActiveDescendantElement = selectedListItem;
  }
}

@annevk and I were chatting about this and it seems that the constraints which led to disallowing elements in Shadow DOM from being used for Element type reflecting IDL attributes on Elements may not apply when it comes to ElementInternals, since ElementInternals won't generally be available to any in-page scripts, and thus can't lead to undesirable dependencies on implementation details within Shadow DOM.

@nolanlawson we were chatting about this in AOM, so I thought you might also have some thoughts to add here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: custom elementsRelates to custom elements (as defined in DOM and HTML)topic: reflectFor issues with reflected IDL attributes and friendstopic: shadowRelates to shadow trees (as defined in DOM)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions