caretPositionFromPoint returns offset 1 for blank space below the text in a textarea
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: birtles, Assigned: emilio)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file, 1 external file)
|
599 bytes,
text/html
|
Details |
Starting in Firefox 150, calling document.caretPositionFromPoint() at a point in the blank area below the text in a multi-line textarea returns the textarea with offset 1.
Firefox 149 returned the end of the textarea value instead. This is also where Firefox places the caret when the blank area is clicked.
The problem was originally reported on Arch Linux and is still reproducible in Firefox 155 on Linux. Works for me on Windows though.
STR
- Open the attached reduced testcase.
- Read the result printed below the textarea.
The testcase calls caretPositionFromPoint() at a point near the bottom middle of the textarea, well below its only line of text.
Actual result
offsetNode: TEXTAREA
offset: 1
Expected result
The offset should be 5, the end of the textarea value:
offsetNode: TEXTAREA
offset: 5
Regression information
- Firefox 149: good
- Firefox 150: bad
- Mozregression pushlog:
https://hg-edge.mozilla.org/integration/autoland/pushloghtml?fromchange=e835d0f9fea4b05436e5f3be55c9c4e31a82f377&tochange=a810895a0020d2d6be3ccf63452b8808a0d020a4 - Regressing bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=2016280 - Regressing commit:
https://github.com/mozilla-firefox/firefox/commit/5624defbfd80
Additional information
The regressing commit moved text-control editors from native anonymous content to UA shadow DOM. It also removed the nsContentUtils::GetAdjustedOffsetInTextControl() call from Document::CaretPositionFromPoint() and removed the helper itself.
That helper specifically corrected offsets when the point was to the right of the text or at the bottom of a textarea by returning the length of the
textarea's content. The new shadow-DOM path does not appear to have an equivalent correction.
Comment 1•3 months ago
|
||
Set release status flags based on info from the regressing bug 2016280
:emilio, since you are the author of the regressor, bug 2016280, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Updated•3 months ago
|
| Assignee | ||
Comment 3•1 month ago
|
||
Hmm, lando seems a bit slow today: https://phabricator.services.mozilla.com/D332960
| Assignee | ||
Comment 4•1 month ago
|
||
This is a bit hacky, but no less correct than what we were doing before.
Updated•1 month ago
|
Updated•1 month ago
|
Comment 6•1 month ago
|
||
| bugherder | ||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/63619 for changes under testing/web-platform/tests
Comment 8•1 month ago
|
||
The patch landed in nightly and ESR is affected.
:emilio, please make an uplift decision for ESR:
- For ESR, nominate the patch for the appropriate ESR uplift approval if the fix should be included in ESR, or set the ESR status flag(s) to
wontfixif an uplift isn't needed. Each affected ESR release needs a decision.
See Requesting an Uplift for documentation on how to request an uplift.
For more information, please visit BugBot documentation.
Upstream PR merged by moz-wptsync-bot
Updated•1 month ago
|
Description
•