| @@ -1,4 +1,5 @@ | ||
| 1 | +import { __ } from '@wordpress/i18n' | |
| 1 | 2 | import '../../entries/editor' |
| 2 | 3 | |
| 3 | 4 | const parseSelect = (select: HTMLSelectElement) => select.options[select.selectedIndex].value |
| 4 | 5 | const parseCheckbox = (checkbox: HTMLInputElement) => checkbox.checked |
| @@ -9,8 +10,12 @@ | ||
| 9 | 10 | const textarea = document.getElementById('code_snippets_editor_preview') |
| 10 | 11 | |
| 11 | 12 | if (textarea && codeEditor) { |
| 12 | 13 | window.code_snippets_editor_preview = codeEditor.initialize(textarea) |
| 14 | + | |
| 15 | + // CodeMirror's own input is unlabelled; name it so the preview reads as what it is. | |
| 16 | + window.code_snippets_editor_preview.codemirror.getInputField().setAttribute('aria-label', __('Code editor preview', 'code-snippets')) | |
| 17 | + | |
| 13 | 18 | return window.code_snippets_editor_preview.codemirror |
| 14 | 19 | } |
| 15 | 20 | |
| 16 | 21 | console.error('Could not initialise CodeMirror on textarea.', textarea) |