Textarea scrollHeight incorrect when dynamically added and overflow: hidden
Categories
(Core :: Layout: Scrolling and Overflow, defect)
Tracking
()
People
(Reporter: knownasilya, Unassigned)
References
(Regression)
Details
(Keywords: regression)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Steps to reproduce:
Dynamically add a textarea (on button click)
- Create it on click
- Set overflow: 'hidden'
- Add to body
- Set value to something that is more then one line, e.g. '1\n2\n3\n'
Reproduction https://codepen.io/tgknownasilya/pen/wvjboOo
Code from the pen:
// Test code
function show() {
const hiddenTextarea = document.createElement('textarea');
hiddenTextarea.style.overflow = 'hidden';
document.body.appendChild(hiddenTextarea);
hiddenTextarea.value = '1\n2\n3\n';
console.log('3 lines', { scrollHeight: hiddenTextarea.scrollHeight });
hiddenTextarea.value = '1\n2\n3\n';
console.log('3 line', { scrollHeight: hiddenTextarea.scrollHeight });
}
Actual results:
Initial value causes incorrect scrollHeight
. Above code snippet logs:
3 lines
Object { scrollHeight: 36 }
3 line
Object { scrollHeight: 68 }
Expected results:
Expect it to log
3 lines
Object { scrollHeight: 68 }
3 line
Object { scrollHeight: 68 }
(note that this is correct in Chrome)
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Scrolling and Overflow' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Reporter | ||
Comment 2•2 years ago
|
||
Note that on Firefox 103 on Linux this issue doesn't exist
Updated•2 years ago
|
Updated•2 years ago
|
Comment 3•2 years ago
|
||
Note its the "Remove useless ProcessPendingRestyles call" changeset that regressed this.
Comment 4•2 years ago
|
||
:emilio, since you are the author of the regressor, bug 1778983, could you take a look? Also, could you set the severity field?
For more information, please visit auto_nag documentation.
Comment 5•2 years ago
|
||
This is basically bug 1787062... It's an issue with editor initialization being async, see there. The good thing is that working around it is trivial (just add another layout-affecting getter call, like scrollHeight
to flush the changes made by editor init.
Description
•