Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ export class TextAreaEditContext extends AbstractEditContext {
const textAreaInputHost: ITextAreaInputHost = {
context: this._context,
getScreenReaderContent: (): TextAreaState => {
if (this._accessibilitySupport === AccessibilitySupport.Disabled) {
// We know for a fact that a screen reader is not attached
if (this._accessibilitySupport === AccessibilitySupport.Disabled || (this._accessibilitySupport === AccessibilitySupport.Unknown && !browser.isAndroid)) {
// No screen reader is known to be attached; a page here gives WebKit an overflow to scroll during IME composition (monaco-editor#4796)
// On OSX, we write the character before the cursor to allow for "long-press" composition
// Also on OSX, we write the word before the cursor to allow for the Accessibility Keyboard to give good hints
const selection = this._selections[0];
Expand Down Expand Up @@ -559,13 +559,13 @@ export class TextAreaEditContext extends AbstractEditContext {
this._accessibilityPageSize = accessibilityPageSize;
}

// When wrapping is enabled and a screen reader might be attached,
// When wrapping is enabled and a screen reader is attached,
// we will size the textarea to match the width used for wrapping points computation (see `domLineBreaksComputer.ts`).
// This is because screen readers will read the text in the textarea and we'd like that the
// wrapping points in the textarea match the wrapping points in the editor.
const layoutInfo = options.get(EditorOption.layoutInfo);
const wrappingColumn = layoutInfo.wrappingColumn;
if (wrappingColumn !== -1 && this._accessibilitySupport !== AccessibilitySupport.Disabled) {
if (wrappingColumn !== -1 && this._accessibilitySupport === AccessibilitySupport.Enabled) {
const fontInfo = options.get(EditorOption.fontInfo);
this._textAreaWrapping = true;
this._textAreaWidth = Math.round(wrappingColumn * fontInfo.typicalHalfwidthCharacterWidth);
Expand Down Expand Up @@ -748,9 +748,6 @@ export class TextAreaEditContext extends AbstractEditContext {
(textareaSpansSingleToken ? viewLineData.tokens.getPresentation(startTokenIndex) : null)
);

this.textArea.domNode.scrollTop = lineCount * lineHeight;
this.textArea.domNode.scrollLeft = scrollLeft;

this._doRender({
lastRenderPosition: null,
top: top,
Expand All @@ -765,6 +762,9 @@ export class TextAreaEditContext extends AbstractEditContext {
strikethrough: presentation.strikethrough,
fontSize
});
// After `_doRender`, as the branch below does: the offsets are clamped against the size it just set
this.textArea.domNode.scrollTop = lineCount * lineHeight;
this.textArea.domNode.scrollLeft = scrollLeft;
}
return;
}
Expand Down