-
Notifications
You must be signed in to change notification settings - Fork 318
Add FormControlRange interface #1404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see a spec for this coming together!
FWIW, I'd rather extend |
We explored extending Range, including shadow host support, but found compatibility and encapsulation issues that made it risky to change existing Range semantics. Based on feedback across discussions, we went with a dedicated FormControlRange instead. The trade-offs and alternatives are covered in the explainer. |
Changing the behavior of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! Next big steps will be defining the right integration points from the HTML spec, and working towards consensus on the API shape.
<a>this</a>'s <a for=FormControlRange>end offset</a> to <var>endOffset</var>. | ||
</ol> | ||
|
||
<p>If an {{HTMLInputElement}}'s <code>type</code> changes to a type that does not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(this, too, will likely need to be something that we'll need to put in the HTML spec)
@rniwa Thanks for the feedback! Yeah, there are a lot of ways this could be done. This suggestion sounds closer to the 2nd considered approach here. There are enough differences in how a Range inside a builtin element would work vs a "normal" range that we believe it will be overall cleaner and less confusing to split the functionality into a different type. For example the behavior we propose here is that a FormControlRange can't have one boundary point inside a Anyway, whatwg/html#11478 is a better place to have this discussion -- more folks are following that issue vs this draft PR. @stephanieyzhang it might be helpful if you could update the PR description for this to point to that issue, as well as a direct link to the explainer. |
Shortname: dom | ||
Text Macro: TWITTER thedomstandard | ||
Text Macro: LATESTRD 2025-06 | ||
Text Macro: COMMIT-SHA 0000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
FormControlRange is a specialized, live AbstractRange subclass for
<input>
/<textarea>
value space. It enables range-based operations in native controls while restricting standardRange
mutations to preserve encapsulation. It integrates cleanly with existing selection/editing behavior and closes a long-standing gap.Explainer: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/FormControlRange/explainer.md
WHATWG Discussion: FormControlRange Interface html#11478
At least two implementers are interested (and none opposed):
Tests are written and can be reviewed and commented upon at:
Implementation bugs are filed:
MDN issue is filed: …
The top of this comment includes a clear commit message to use.
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff