Status Update
Comments
ro...@gmail.com <ro...@gmail.com> #2
Looks like I can't edit the original post, so here's the reproduction code in a codeblock:
document.body.innerHTML = `<textarea id="textEl" spellcheck="false" style="width:100%; height:100%; font-family:monospace; white-space:pre-wrap;"></textarea>`;
textEl.value = new Array(2_000_000).fill(0).map(_ => "a").join(" ");
go...@google.com <go...@google.com> #3
go...@google.com <go...@google.com> #4
Steps to reproduce
================
1. Launched Chrome
2. Opened "about:blank" in new tab
3. Open DevTools -> Console and paste this code which creates a textarea with a lot of text:
document.body.innerHTML = `<textarea id="textEl" spellcheck="false" style="width:100%; height:100%; font-family:monospace; white-space:pre-wrap;"></textarea>`;
textEl.value = new Array(2_000_000).fill(0).map(_ => "a").join(" ");
4. Observed - scrolled down to the bottom and noticeed the weird wrapping where it doesn't go to the end of the line. Also notice that there's a horizontal scrollbar when there shouldn't be.
tried typing quickly in the textarea and page crashed
Attached screencast for reference
Reporter@: Could you please review the attached reference and let us know if anything being missed here.
Could we consider point 4 as a bad behaviour and issue you are pointing to ?
Could you please confirm if the issue is similar to
Thanks..!!
ro...@gmail.com <ro...@gmail.com> #5
Could you please confirm if the issue is similar to crbug.com/341406781
The issue is not related - I specifically added spellcheck="false"
to ensure this.
You have correctly replicated the issue. Thanks!
pe...@google.com <pe...@google.com> #6
go...@google.com <go...@google.com> #7
Tried typing quickly in the text area and page did not crash, could you please confirm if we can consider this as bad behaviour ?
Thanks..!!
ro...@gmail.com <ro...@gmail.com> #8
Yep, the wrapping problem is a bug, so 114 still has an issue here.
pe...@google.com <pe...@google.com> #9
vd...@google.com <vd...@google.com> #10
Observed weird wrapping
Reproducible On:
-----------------------
127.0.6497.0 - Canary
127.0.6485.0 - Dev
126.0.6478.17 - Beta
125.0.6422.78 - Stable
The same issue seems to be reproducible from M-114 older versions, hence considering it as Non-Regression and marking it as untriaged.
Thanks..!!
ro...@gmail.com <ro...@gmail.com> #11
Been a few months now, so just checking in - any chance this can be looked into? Interaction on text areas with book-length text is very laggy (and "crashy") on Chrome, but fine on Firefox.
As mentioned above, repro is very simple:
document.body.innerHTML = `<textarea id="textareaEl" spellcheck="false" style="width:300px; height:300px;">${"a ".repeat(2_000_000)}</textarea>`;
textareaEl.scrollTop = textareaEl.scrollHeight;
Then just try typing into the textarea.
On smartphone the number of characters can be significantly smaller to replicate the issue. On low-end phones, Chrome's textarea is really really bad for long text.
to...@google.com <to...@google.com> #12
Reproduces on my gMac laptop - last line wrap is clearly wrong; does not reproduce on my gLinux desktop - last line wrap is correct.
ro...@google.com <ro...@google.com>
ch...@google.com <ch...@google.com>
tk...@chromium.org <tk...@chromium.org> #13
new Array(2_000_000).fill(0).map(_ => "a").join(" ")
Reporter,
Are you concerned about performance on a single giant paragraph with no line breaks? If you're concerned about performance on multiple paragraphs with line breaks, that's relatively easy to improve.
ro...@gmail.com <ro...@gmail.com> #14
If I had to guess, at least 95% of the time that the problem occurs "in the wild" on my experience (i.e. real user problems, not contrived/edge/weird cases), there are line breaks. I.e. lots of paragraphs.
That remaining 5% might seem quite high, but it's because there is one "weird" case which is not super uncommon: data URLs. I don't know the exact percentage to put on it, but it's a non-trivial amount. Much less common than the lots-of-paragraphs case though.
(Aside: This data URL problem also exists with <input> elements where the application generally expects a URL, but can also handle a data URL. Even when using a monospace font, turning off spellcheck, etc. there was still significant lag last time I checked, but I don't think I've ever had reports of page crashing or at least being able to replicate page crashing. Just significant lag, especially on low end devices. And no lag on Firefox. But there could be a separate underlying cause to this <textarea> case.)
tk...@chromium.org <tk...@chromium.org> #15
Thank you for the information. Now I understand both of a giant paragraph and huge number of paragraphs are problematic.
I have filed
Description
Steps to reproduce the problem
document.body.innerHTML =
<textarea id="textEl" spellcheck="false" style="width:100%; height:100%; font-family:monospace; white-space:pre-wrap;"></textarea>
; textEl.value = new Array(2_000_000).fill(0).map(_ => "a").join(" ")Problem Description
In my tests, Firefox and Safari are much faster at dealing with large amounts of text in textareas (e.g. text that is as big as a large book/novel).
Also, Chrome doesn't render the text properly. See the reproduction steps and/or the video attached to this report.
I have users on Android Chrome who complain of laggy editing with large amounts of text, which prompted me to investigate. Note that I've shown an extreme case of millions of characters to make the issue very evident even on dev laptops. The performance issues occur at lower character counts on mobile devices (especially non-high-end ones).
Additional Comments
Note that in the attached video I gave up on waiting for Chrome to stop freezing (after typing a sequence of "a" characters) after 30 seconds or so, and then demonstrated Firefox near the end of the video.
I've added style="white-space:pre-wrap; font-family:monospace" and spellcheck="false" in an attempt to improve performance in the reproduction code.
Also maybe worth mentioning that VSCode (with text wrapping enabled) is extremely fast/responsive - much faster than Chrome and Firefox. This isn't too surprising because it obviously doesn't use textareas, and has been heavily optimized for a large amount of text, and probably because line height is fixed, and a bunch of other constraints that VSCode devs can rely on. Still, worth at least mentioning as an (probably unattainable, but perhaps aspirational) goal.
Summary
textarea rendering is broken and interaction is extremely slow for big texts
Custom Questions
Does this work in other browsers?
Yes - This is just a Chrome problem
Additional Data
Category: API
Chrome Channel: Stable
Regression: N/A