-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Integrate OpaqueRange hooks into text controls (input/textarea) #11741
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
annevk
left a comment
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.
Where is "supports opaque ranges" defined?
| <th> <code data-x="dom-textarea/input-getValueRange">getValueRange()</code> | ||
| <td class="no"> · <!-- Hidden --> | ||
| <td class="yes"> Yes <!-- Text --> | ||
| <td class="yes"> Yes <!-- Search --> |
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 seems wrong. Text and Search are the same column.
| <li><p>Let <var>delta</var> be <var>replacementLength</var> minus (<var>replaceEnd</var> − <var>replaceStart</var>).</p></li> | ||
|
|
||
| <li> | ||
| <p>For each <code data-x="dom-Range-OpaqueRange">OpaqueRange</code> object <var>range</var> associated with <var>element</var>, |
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.
If elements have to hold onto a range object we should make that explicit.
| <ol> | ||
| <li> | ||
| <p>For each boundary offset of <var>range</var> (its <code data-x="dom-AbstractRange-startOffset">startOffset</code> and its | ||
| <code data-x="dom-AbstractRange-endOffset">endOffset</code>), run these substeps:</p> |
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.
I think this also needs some rewording. Perhaps you can define a set of steps and then run them for both. But we also don't want to reference public API in the user agent processing model.
| <code data-x="dom-AbstractRange-endOffset">endOffset</code>), run these substeps:</p> | ||
|
|
||
| <ol> | ||
| <li><p>If the boundary offset is less than or equal to <var>replaceStart</var>, then continue.</p></li> |
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.
continue needs to be referenced.
| <p>The <code data-x="dom-textarea-defaultValue">defaultValue</code> attribute's setter must | ||
| <span>string replace all</span> with the given value within this element.</p> | ||
| <span>string replace all</span> with the given value within this element. | ||
| If this changes the element's <span data-x="concept-textarea-raw-value">raw value</span>, and the |
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.
We generally don't accept COMEFROM. And string replace all always changes the underlying node so "if this changes" is kinda moot anyway.
OpaqueRange is a specialized, live AbstractRange subtype whose endpoints are offsets into a host-defined opaque string (e.g. the value space of
<input>/<textarea>today, with a path to custom elements in the future). It enables range-based operations over encapsulated value text while avoiding exposure of internal DOM nodes.Explainer: https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/OpaqueRange/explainer.md
WhatWG discussion: FormControlRange Interface #11478
Corresponding DOM Spec PR: Add OpaqueRange interface dom#1404
Corresponding CSSOM PR: [cssom-view-1] Define OpaqueRange geometry APIs (getClientRects/getBoundingClientRect) w3c/csswg-drafts#12904
At least two implementers are interested (and none opposed):
Tests are written and can be reviewed and commented upon at:
Implementation bugs are filed:
Corresponding HTML AAM & ARIA in HTML issues & PRs:
MDN issue is filed: …
The top of this comment includes a clear commit message to use.
(See WHATWG Working Mode: Changes for more details.)
/form-control-infrastructure.html ( diff )
/form-elements.html ( diff )
/index.html ( diff )
/input.html ( diff )