mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-12 19:39:20 -05:00
Fixes #6878: Add limits to the ammount of text we write to the <textarea> for screen readers to avoid stalling the UI.
This commit is contained in:
@@ -400,7 +400,7 @@ export class NVDAPagedTextAreaState extends TextAreaState {
|
||||
let posttext = model.getValueInRange(posttextRange, EndOfLinePreference.LF);
|
||||
|
||||
let text:string = null;
|
||||
if (selectionStartPage <= selectionEndPage) {
|
||||
if (selectionStartPage === selectionEndPage || selectionStartPage + 1 === selectionEndPage) {
|
||||
// take full selection
|
||||
text = model.getValueInRange(selection, EndOfLinePreference.LF);
|
||||
} else {
|
||||
@@ -413,6 +413,19 @@ export class NVDAPagedTextAreaState extends TextAreaState {
|
||||
);
|
||||
}
|
||||
|
||||
// Chromium handles very poorly text even of a few thousand chars
|
||||
// Cut text to avoid stalling the entire UI
|
||||
const LIMIT_CHARS = 500;
|
||||
if (pretext.length > LIMIT_CHARS) {
|
||||
pretext = pretext.substring(pretext.length - LIMIT_CHARS, pretext.length);
|
||||
}
|
||||
if (posttext.length > LIMIT_CHARS) {
|
||||
posttext = posttext.substring(0, LIMIT_CHARS);
|
||||
}
|
||||
if (text.length > 2 * LIMIT_CHARS) {
|
||||
text = text.substring(0, LIMIT_CHARS) + String.fromCharCode(8230) + text.substring(text.length - LIMIT_CHARS, text.length);
|
||||
}
|
||||
|
||||
return new NVDAPagedTextAreaState(this, pretext + text + posttext, pretext.length, pretext.length + text.length, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user