Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes https://github.com/microsoft/monaco-editor/issues/4021 #187318

Merged
merged 2 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/vs/editor/browser/controller/textAreaHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ export class TextAreaHandler extends ViewPart {
this.textArea.setAttribute('autocomplete', 'off');
this.textArea.setAttribute('spellcheck', 'false');
this.textArea.setAttribute('aria-label', this._getAriaLabel(options));
this.textArea.setAttribute('aria-required', options.get(EditorOption.ariaRequired) ? 'true' : 'false');
this.textArea.setAttribute('tabindex', String(options.get(EditorOption.tabIndex)));
this.textArea.setAttribute('role', 'textbox');
this.textArea.setAttribute('aria-roledescription', nls.localize('editor', "editor"));
Expand Down Expand Up @@ -601,6 +602,7 @@ export class TextAreaHandler extends ViewPart {
const { tabSize } = this._context.viewModel.model.getOptions();
this.textArea.domNode.style.tabSize = `${tabSize * this._fontInfo.spaceWidth}px`;
this.textArea.setAttribute('aria-label', this._getAriaLabel(options));
this.textArea.setAttribute('aria-required', options.get(EditorOption.ariaRequired) ? 'true' : 'false');
this.textArea.setAttribute('tabindex', String(options.get(EditorOption.tabIndex)));

if (e.hasChanged(EditorOption.domReadOnly) || e.hasChanged(EditorOption.readOnly)) {
Expand Down
9 changes: 9 additions & 0 deletions src/vs/editor/common/config/editorOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ export interface IEditorOptions {
* The aria label for the editor's textarea (when it is focused).
*/
ariaLabel?: string;

/**
* Whether the aria-required attribute should be set on the editors textarea.
*/
ariaRequired?: boolean;
/**
* Control whether a screen reader announces inline suggestion content immediately.
*/
Expand Down Expand Up @@ -4972,6 +4977,7 @@ export const enum EditorOption {
accessibilitySupport,
accessibilityPageSize,
ariaLabel,
ariaRequired,
autoClosingBrackets,
screenReaderAnnounceInlineSuggestion,
autoClosingDelete,
Expand Down Expand Up @@ -5142,6 +5148,9 @@ export const EditorOptions = {
ariaLabel: register(new EditorStringOption(
EditorOption.ariaLabel, 'ariaLabel', nls.localize('editorViewAccessibleLabel', "Editor content")
)),
ariaRequired: register(new EditorBooleanOption(
EditorOption.ariaRequired, 'ariaRequired', false, undefined
)),
screenReaderAnnounceInlineSuggestion: register(new EditorBooleanOption(
EditorOption.screenReaderAnnounceInlineSuggestion, 'screenReaderAnnounceInlineSuggestion', true,
{
Expand Down
281 changes: 141 additions & 140 deletions src/vs/editor/common/standalone/standaloneEnums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,146 +178,147 @@ export enum EditorOption {
accessibilitySupport = 2,
accessibilityPageSize = 3,
ariaLabel = 4,
autoClosingBrackets = 5,
screenReaderAnnounceInlineSuggestion = 6,
autoClosingDelete = 7,
autoClosingOvertype = 8,
autoClosingQuotes = 9,
autoIndent = 10,
automaticLayout = 11,
autoSurround = 12,
bracketPairColorization = 13,
guides = 14,
codeLens = 15,
codeLensFontFamily = 16,
codeLensFontSize = 17,
colorDecorators = 18,
colorDecoratorsLimit = 19,
columnSelection = 20,
comments = 21,
contextmenu = 22,
copyWithSyntaxHighlighting = 23,
cursorBlinking = 24,
cursorSmoothCaretAnimation = 25,
cursorStyle = 26,
cursorSurroundingLines = 27,
cursorSurroundingLinesStyle = 28,
cursorWidth = 29,
disableLayerHinting = 30,
disableMonospaceOptimizations = 31,
domReadOnly = 32,
dragAndDrop = 33,
dropIntoEditor = 34,
emptySelectionClipboard = 35,
experimentalWhitespaceRendering = 36,
extraEditorClassName = 37,
fastScrollSensitivity = 38,
find = 39,
fixedOverflowWidgets = 40,
folding = 41,
foldingStrategy = 42,
foldingHighlight = 43,
foldingImportsByDefault = 44,
foldingMaximumRegions = 45,
unfoldOnClickAfterEndOfLine = 46,
fontFamily = 47,
fontInfo = 48,
fontLigatures = 49,
fontSize = 50,
fontWeight = 51,
fontVariations = 52,
formatOnPaste = 53,
formatOnType = 54,
glyphMargin = 55,
gotoLocation = 56,
hideCursorInOverviewRuler = 57,
hover = 58,
inDiffEditor = 59,
inlineSuggest = 60,
letterSpacing = 61,
lightbulb = 62,
lineDecorationsWidth = 63,
lineHeight = 64,
lineNumbers = 65,
lineNumbersMinChars = 66,
linkedEditing = 67,
links = 68,
matchBrackets = 69,
minimap = 70,
mouseStyle = 71,
mouseWheelScrollSensitivity = 72,
mouseWheelZoom = 73,
multiCursorMergeOverlapping = 74,
multiCursorModifier = 75,
multiCursorPaste = 76,
multiCursorLimit = 77,
occurrencesHighlight = 78,
overviewRulerBorder = 79,
overviewRulerLanes = 80,
padding = 81,
pasteAs = 82,
parameterHints = 83,
peekWidgetDefaultFocus = 84,
definitionLinkOpensInPeek = 85,
quickSuggestions = 86,
quickSuggestionsDelay = 87,
readOnly = 88,
readOnlyMessage = 89,
renameOnType = 90,
renderControlCharacters = 91,
renderFinalNewline = 92,
renderLineHighlight = 93,
renderLineHighlightOnlyWhenFocus = 94,
renderValidationDecorations = 95,
renderWhitespace = 96,
revealHorizontalRightPadding = 97,
roundedSelection = 98,
rulers = 99,
scrollbar = 100,
scrollBeyondLastColumn = 101,
scrollBeyondLastLine = 102,
scrollPredominantAxis = 103,
selectionClipboard = 104,
selectionHighlight = 105,
selectOnLineNumbers = 106,
showFoldingControls = 107,
showUnused = 108,
snippetSuggestions = 109,
smartSelect = 110,
smoothScrolling = 111,
stickyScroll = 112,
stickyTabStops = 113,
stopRenderingLineAfter = 114,
suggest = 115,
suggestFontSize = 116,
suggestLineHeight = 117,
suggestOnTriggerCharacters = 118,
suggestSelection = 119,
tabCompletion = 120,
tabIndex = 121,
unicodeHighlighting = 122,
unusualLineTerminators = 123,
useShadowDOM = 124,
useTabStops = 125,
wordBreak = 126,
wordSeparators = 127,
wordWrap = 128,
wordWrapBreakAfterCharacters = 129,
wordWrapBreakBeforeCharacters = 130,
wordWrapColumn = 131,
wordWrapOverride1 = 132,
wordWrapOverride2 = 133,
wrappingIndent = 134,
wrappingStrategy = 135,
showDeprecated = 136,
inlayHints = 137,
editorClassName = 138,
pixelRatio = 139,
tabFocusMode = 140,
layoutInfo = 141,
wrappingInfo = 142,
defaultColorDecorators = 143,
colorDecoratorsActivatedOn = 144
ariaRequired = 5,
autoClosingBrackets = 6,
screenReaderAnnounceInlineSuggestion = 7,
autoClosingDelete = 8,
autoClosingOvertype = 9,
autoClosingQuotes = 10,
autoIndent = 11,
automaticLayout = 12,
autoSurround = 13,
bracketPairColorization = 14,
guides = 15,
codeLens = 16,
codeLensFontFamily = 17,
codeLensFontSize = 18,
colorDecorators = 19,
colorDecoratorsLimit = 20,
columnSelection = 21,
comments = 22,
contextmenu = 23,
copyWithSyntaxHighlighting = 24,
cursorBlinking = 25,
cursorSmoothCaretAnimation = 26,
cursorStyle = 27,
cursorSurroundingLines = 28,
cursorSurroundingLinesStyle = 29,
cursorWidth = 30,
disableLayerHinting = 31,
disableMonospaceOptimizations = 32,
domReadOnly = 33,
dragAndDrop = 34,
dropIntoEditor = 35,
emptySelectionClipboard = 36,
experimentalWhitespaceRendering = 37,
extraEditorClassName = 38,
fastScrollSensitivity = 39,
find = 40,
fixedOverflowWidgets = 41,
folding = 42,
foldingStrategy = 43,
foldingHighlight = 44,
foldingImportsByDefault = 45,
foldingMaximumRegions = 46,
unfoldOnClickAfterEndOfLine = 47,
fontFamily = 48,
fontInfo = 49,
fontLigatures = 50,
fontSize = 51,
fontWeight = 52,
fontVariations = 53,
formatOnPaste = 54,
formatOnType = 55,
glyphMargin = 56,
gotoLocation = 57,
hideCursorInOverviewRuler = 58,
hover = 59,
inDiffEditor = 60,
inlineSuggest = 61,
letterSpacing = 62,
lightbulb = 63,
lineDecorationsWidth = 64,
lineHeight = 65,
lineNumbers = 66,
lineNumbersMinChars = 67,
linkedEditing = 68,
links = 69,
matchBrackets = 70,
minimap = 71,
mouseStyle = 72,
mouseWheelScrollSensitivity = 73,
mouseWheelZoom = 74,
multiCursorMergeOverlapping = 75,
multiCursorModifier = 76,
multiCursorPaste = 77,
multiCursorLimit = 78,
occurrencesHighlight = 79,
overviewRulerBorder = 80,
overviewRulerLanes = 81,
padding = 82,
pasteAs = 83,
parameterHints = 84,
peekWidgetDefaultFocus = 85,
definitionLinkOpensInPeek = 86,
quickSuggestions = 87,
quickSuggestionsDelay = 88,
readOnly = 89,
readOnlyMessage = 90,
renameOnType = 91,
renderControlCharacters = 92,
renderFinalNewline = 93,
renderLineHighlight = 94,
renderLineHighlightOnlyWhenFocus = 95,
renderValidationDecorations = 96,
renderWhitespace = 97,
revealHorizontalRightPadding = 98,
roundedSelection = 99,
rulers = 100,
scrollbar = 101,
scrollBeyondLastColumn = 102,
scrollBeyondLastLine = 103,
scrollPredominantAxis = 104,
selectionClipboard = 105,
selectionHighlight = 106,
selectOnLineNumbers = 107,
showFoldingControls = 108,
showUnused = 109,
snippetSuggestions = 110,
smartSelect = 111,
smoothScrolling = 112,
stickyScroll = 113,
stickyTabStops = 114,
stopRenderingLineAfter = 115,
suggest = 116,
suggestFontSize = 117,
suggestLineHeight = 118,
suggestOnTriggerCharacters = 119,
suggestSelection = 120,
tabCompletion = 121,
tabIndex = 122,
unicodeHighlighting = 123,
unusualLineTerminators = 124,
useShadowDOM = 125,
useTabStops = 126,
wordBreak = 127,
wordSeparators = 128,
wordWrap = 129,
wordWrapBreakAfterCharacters = 130,
wordWrapBreakBeforeCharacters = 131,
wordWrapColumn = 132,
wordWrapOverride1 = 133,
wordWrapOverride2 = 134,
wrappingIndent = 135,
wrappingStrategy = 136,
showDeprecated = 137,
inlayHints = 138,
editorClassName = 139,
pixelRatio = 140,
tabFocusMode = 141,
layoutInfo = 142,
wrappingInfo = 143,
defaultColorDecorators = 144,
colorDecoratorsActivatedOn = 145
}

/**
Expand Down