[Platform-provided behaviors for CE] Address feedback, add alternative to main proposal#1340
Open
anaskim wants to merge 2 commits into
Open
Conversation
Apply feedback from WHATWG #12150 and from multiple internal review rounds across the main explainer's User-facing problem, User research, Dynamic behaviors, Alt API design 3, and HTMLSubmitButtonBehavior Properties sections. Add Alt API design 5 (standard-defined strings) covering the shapes raised in WHATWG #12150. Move Behavior composition and conflict resolution into Future work. Replace prescriptive attachInternals() lifecycle guidance with neutral language. Cut duplicate examples and convert the Behavior lifecycle table to prose. Add htmlbuttonbehavior-with-type-attribute.md, a side document exploring an alternative direction that collapses the three button modes (submit, reset, generic-button) into a single HTMLButtonBehavior whose type property mirrors native <button>'s type attribute, and declares behaviors via a static class property (symmetric with static formAssociated) with platform-owned instantiation. Authors look up the platform-created instance through internals.behaviors.get(HTMLButtonBehavior). Net contribution vs. upstream/main: 2 files, +358 / -236.
dcf7800 to
9708740
Compare
`HTMLButtonElement`'s IDL adds form-control properties on top of `HTMLElement` but does not override `title`, `tabIndex`, `hidden`, `lang`, `dir`, `accessKey`, or `draggable`. All of these are pure `HTMLElement` surface that custom elements already inherit. Including `title` in the behavior interface would be redundant and would imply the behavior is involved in tooltip surfacing when it is not. Drop `title` from the Properties lists in both the main explainer (`HTMLSubmitButtonBehavior`) and the type-attribute alternative (`HTMLButtonBehavior`). Add a short note after each list pointing out that `HTMLElement`-inherited properties work directly on the host without behavior involvement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates
Main explainer
<button type="submit">as a single-element conformance target that exercises every part of the framework.attachInternals()lifecycle:attachInternals()can be called from the constructor,connectedCallback, orattributeChangedCallback, depending on whether attributes are set before or after construction.HTMLSubmitButtonBehaviorships initially; composition becomes relevant once additional behaviors land).HTMLSubmitButtonBehaviorproperties: Addedtitlewith a note that it surfaces through the user agent's default tooltip UI. Removed theattributeChangedCallbackexample.New alternative
New file:
PlatformProvidedBehaviors/htmlbuttonbehavior-with-type-attribute.md. Side document exploring an alternative:HTMLButtonBehaviorwhosetypeproperty mirrors thetypeattribute of native<button>and toggles the active mode at runtime.static behaviorsclass property. The platform instantiates each declared behavior at element creation; authors look up the instance throughinternals.behaviors.get(HTMLButtonBehavior).