Skip to content

Add platform-provided behaviors for custom elements demo#130

Open
anaskim wants to merge 3 commits intoMicrosoftEdge:mainfrom
anaskim:platform-behaviors
Open

Add platform-provided behaviors for custom elements demo#130
anaskim wants to merge 3 commits intoMicrosoftEdge:mainfrom
anaskim:platform-behaviors

Conversation

@anaskim
Copy link
Copy Markdown
Member

@anaskim anaskim commented May 5, 2026

Adds an interactive demo page for platform-provided behaviors for custom elements. The demo showcases HTMLSubmitButtonBehavior, which allows a custom element to act as a native submit button through attachInternals({ behaviors: [...] }).

Use cases demonstrated

  1. Basic form submission: a custom element submits a form the same way a native <button type="submit"> does.
  2. Form override properties: setting name, value, and formMethod on the behavior instance, with a note on attributeChangedCallback for attribute reflection.
  3. Implicit submission: pressing Enter in a text field triggers submission through the custom element.
  4. Accessibility and keyboard activation: the element gets role="button", focusability, and Enter/Space activation with no extra code. Includes a comparison with what the developer would need to wire up manually.

Related links

Comment thread README.md Outdated
Comment thread platform-behaviors/README.md Outdated
Comment thread platform-behaviors/README.md Outdated
Comment thread platform-behaviors/README.md Outdated
Comment thread platform-behaviors/index.html
Comment thread platform-behaviors/script.js Outdated
Comment thread platform-provided-behaviors-for-custom-elements/index.html
Comment thread platform-behaviors/style.css Outdated
Comment thread platform-behaviors/style.css Outdated
@anaskim anaskim force-pushed the platform-behaviors branch from 551f8a0 to 04f08a7 Compare May 7, 2026 18:56
@anaskim anaskim force-pushed the platform-behaviors branch from 6da9080 to 8f9b04b Compare May 8, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants