Skip to content

Commit aa67bfe

Browse files
authored
Merge pull request #349 from codesnippetspro/a11y-code-mirror
Fix: improve code-mirror accessibility (tab trap)
2 parents bbfeffc + 318dfa3 commit aa67bfe

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/js/components/EditMenu/SnippetForm/SnippetForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,15 @@ const EditFormWrap: React.FC = () => {
152152
<Notices placement="above-form" />
153153

154154
<EditForm className={editFormClassName({ snippet, isReadOnly, isExpanded })}>
155-
<main className="snippet-form-upper">
155+
<div className="snippet-form-upper">
156156
<div className="snippet-name-wrapper">
157157
<NameInput />
158158
<SnippetTypeInput setIsUpgradeDialogOpen={setIsUpgradeDialogOpen} />
159159
</div>
160160

161161
<CodeEditor {...{ isExpanded, setIsExpanded }} />
162162
<ConditionsEditor />
163-
</main>
163+
</div>
164164

165165
<div className="snippet-form-lower">
166166
<UpsellBanner />

src/js/components/EditMenu/SnippetForm/fields/CodeEditor.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ const EditorTextarea: React.FC<EditorTextareaProps> = ({ textareaRef }) => {
4141
const { snippet, setSnippet } = useSnippetForm()
4242

4343
return (
44-
<div className="snippet-editor">
44+
<div
45+
className="snippet-editor"
46+
role="application"
47+
aria-label={__('Code editor', 'code-snippets')}
48+
aria-description={__('In the editing area, the Tab key enters a tab character. To exit the code editor, press the Escape key and then the Tab key.', 'code-snippets')}
49+
>
4550
<textarea
4651
ref={textareaRef}
4752
id="snippet-code"

0 commit comments

Comments
 (0)