Changing the `placeholder` property of the input cause loss of editing history.
Categories
(Core :: DOM: Editor, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox82 | --- | fixed |
People
(Reporter: nayinain, Assigned: emilio)
References
Details
Attachments
(2 files, 1 obsolete file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
Steps to reproduce:
- Open the
testcase.html
- Delete the text in
input 1
ortextarea 1
. - Undo (<kbd>Ctrl + Z</kbd>) the changes.
Actual results:
Cannot undo changes.
Expected results:
Can undo the changes.
Comment 2•4 years ago
|
||
:nayinain, if you think that's a regression, then could you try to find a regression range in using for example mozregression?
Comment 3•4 years ago
|
||
It seems that editor instance is recreated when placeholder
attribute is changed.
https://searchfox.org/mozilla-central/rev/ab81b8552f4aa9696a2524f97fdfeb59d4dc31c1/dom/html/HTMLInputElement.cpp#5181-5182
If so, editor is recreated without previous transaction.
emilio: Any ideas?
Assignee | ||
Comment 4•4 years ago
|
||
Changing the placeholder attribute reconstruct the layout frame.
Same seems happens if instead of changing placeholder I toggle .style.display
, fwiw.
We don't seem to preserve the editing history across reframes, which seems a bit unexpected? Masayuki, do you know what is the background for this if any?
For this specific case, we probably can avoid reframing by incrementally updating the textnode in nsTextControlFrame::CreatePlaceholderIfNeeded
(and only reframe if it's an addition / removal). But the root cause is ^ I think.
Comment 5•4 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #4)
We don't seem to preserve the editing history across reframes, which seems a bit unexpected? Masayuki, do you know what is the background for this if any?
As this bug reported, I feel it's unexpected behavior setting placeholder
value resets editor transactions (if I were a web app developer).
For this specific case, we probably can avoid reframing by incrementally updating the textnode in
nsTextControlFrame::CreatePlaceholderIfNeeded
(and only reframe if it's an addition / removal). But the root cause is ^ I think.
Yeah, I also guessed that the root cause is difficult to fix. I think that we don't need to fix only specific cases. So, perhaps, we should do it if actual web-compat issue is reported.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 6•4 years ago
|
||
We still reframe for additions / removals of the attribute because that
makes us create the placeholder <div>. We could avoid it if we created
it independently of the presence of the attribute but that seems like it
could regress perf for the case where there's no placeholder attribute,
which is probably common enough.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 7•4 years ago
|
||
There's nothing in nsFileControlFrame that would change the frame tree
depending on these attributes.
Updated•4 years ago
|
Comment 9•4 years ago
|
||
bugherder |
Comment 10•4 years ago
|
||
Updated•4 years ago
|
Comment 11•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Comment 13•4 years ago
|
||
bugherder |
Description
•