Skip to content

Conversation

@anaskim
Copy link
Contributor

@anaskim anaskim commented Dec 12, 2025

V1 includes:

  • Rewording on interoperability.
  • Adds examples on current workarounds used by frameworks.
  • Adds goal to clarify the general and specific objectives of the proposal.
  • "behavior" -> "mixin", to avoid confusion with "behaviour" spelling.
  • Simplifies to add mixins to attachInternals() and avoid dynamic changes at runtime.
  • Adds mixins property to ElementInternals to query behaviors.
  • Removed "Open questions" section and expanded "Future Work" section with a "collision handling" note and 2 more proposed mixins (input and table behaviors).
  • Updated "Accessibility, Security, and Privacy Considerations" section.
  • Updated acknowledgements.

@anaskim anaskim marked this pull request as ready for review December 12, 2025 21:47

**Pros:**
- Familiar JavaScript pattern.
- Prototype-based composition.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another pro to this approach is that it allows for child classes to easily extend from mixins. e.g.

class CustomSubmitButton extends HTMLSubmitButtonMixin(HTMLElement) { ... }
class ExtraCustomSubmitButton extends CustomSubmitButton {...}

Is this possible with the current mixin proposal?


**Cons:**
- Interoperability issues across browsers.
- Limited Shadow DOM support.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rephrase this as "Limited Shadow DOM support - only certain elements can be shadow hosts" and link to https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow#elements_you_can_attach_a_shadow_to


Custom element authors can't access platform behaviors that are built into native HTML elements. This forces them to either:

1. Use customized built-ins (`is/extends` syntax), which have Shadow DOM limitations and [can't use the ElementInternals API](https://github.com/whatwg/html/issues/5166).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


### Goals

- Establish an extensible framework for custom elements to adopt platform behaviors.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"platform behaviors" is a bit vague, maybe say "platform behaviors for built in elements"

**Cons:**
- Doesn't currently address form submission behavior.
- Scoped to specific attributes rather than general behaviors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to list "Extend Markup Like Customizable Select"? Or is that too different of a problem? The dealbreaking con with this approach is that it won't work for all types (or any types beyond select?).

https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Forms/Customizable_select

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants