From dc97da127658a1562b2b74e0ca501f7585985529 Mon Sep 17 00:00:00 2001 From: Rebeka Dekany <50901361+rebekadekany@users.noreply.github.com> Date: Tue, 1 Jul 2025 13:48:37 +0200 Subject: [PATCH] Add accessible names to the editor editing field (#26678) GitOrigin-RevId: 2ebed9db517c288450230675ae038d0cc3260a61 --- .../frontend/js/features/source-editor/extensions/index.ts | 6 +++++- .../js/features/source-editor/extensions/visual/visual.ts | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/source-editor/extensions/index.ts b/services/web/frontend/js/features/source-editor/extensions/index.ts index 0e19d42fc1..9cf6906b51 100644 --- a/services/web/frontend/js/features/source-editor/extensions/index.ts +++ b/services/web/frontend/js/features/source-editor/extensions/index.ts @@ -35,7 +35,7 @@ import importOverleafModules from '../../../../macros/import-overleaf-module.mac import { emptyLineFiller } from './empty-line-filler' import { goToLinePanel } from './go-to-line' import { drawSelection } from './draw-selection' -import { visual } from './visual/visual' +import { sourceOnly, visual } from './visual/visual' import { inlineBackground } from './inline-background' import { indentationMarkers } from './indentation-markers' import { codemirrorDevTools } from '../languages/latex/codemirror-dev-tools' @@ -78,6 +78,10 @@ export const createExtensions = (options: Record): Extension[] => [ EditorState.allowMultipleSelections.of(true), // A built-in extension that enables soft line wrapping. EditorView.lineWrapping, + sourceOnly( + options.visual, + EditorView.contentAttributes.of({ 'aria-label': 'Source Editor editing' }) + ), // A built-in extension that re-indents input if the language defines an indentOnInput field in its language data. indentOnInput(), lineWrappingIndentation(options.visual.visual), diff --git a/services/web/frontend/js/features/source-editor/extensions/visual/visual.ts b/services/web/frontend/js/features/source-editor/extensions/visual/visual.ts index e644910c59..af6d2e559a 100644 --- a/services/web/frontend/js/features/source-editor/extensions/visual/visual.ts +++ b/services/web/frontend/js/features/source-editor/extensions/visual/visual.ts @@ -178,4 +178,5 @@ const extension = (options: Options) => [ showContentWhenParsed, pasteHtml, tableGeneratorTheme, + EditorView.contentAttributes.of({ 'aria-label': 'Visual Editor editing' }), ]