File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333 </ script >
3434</ head >
3535< body >
36- < div id ="editor " role =" textbox " aria-multiline =" true " > </ div >
36+ < div id ="editor "> </ div >
3737 < script type =module src ="./index.ts "> </ script >
3838</ body >
3939</ html >
Original file line number Diff line number Diff line change @@ -160,6 +160,12 @@ export function extensions(options: { lineBreak?: string }) {
160160 wordTokenizer ( ) ,
161161 interceptInputs ( ) ,
162162 observeChanges ( ) ,
163+
164+ // Accessibility
165+ EditorView . contentAttributes . of ( {
166+ 'role' : 'textbox' ,
167+ 'aria-multiline' : 'true' ,
168+ } ) ,
163169 ] ;
164170}
165171
Original file line number Diff line number Diff line change 1+ import { describe , expect , test } from '@jest/globals' ;
2+ import { EditorView } from '@codemirror/view' ;
3+ import * as editor from './utils/editor' ;
4+
5+ describe ( 'Accessibility test suite' , ( ) => {
6+ test ( 'test contentDOM has role textbox' , ( ) => {
7+ editor . setUp ( '' , EditorView . contentAttributes . of ( {
8+ 'role' : 'textbox' ,
9+ 'aria-multiline' : 'true' ,
10+ } ) ) ;
11+
12+ const contentDOM = window . editor . contentDOM ;
13+ expect ( contentDOM . getAttribute ( 'role' ) ) . toBe ( 'textbox' ) ;
14+ } ) ;
15+
16+ test ( 'test contentDOM has aria-multiline' , ( ) => {
17+ editor . setUp ( '' , EditorView . contentAttributes . of ( {
18+ 'role' : 'textbox' ,
19+ 'aria-multiline' : 'true' ,
20+ } ) ) ;
21+
22+ const contentDOM = window . editor . contentDOM ;
23+ expect ( contentDOM . getAttribute ( 'aria-multiline' ) ) . toBe ( 'true' ) ;
24+ } ) ;
25+
26+ test ( 'test contentDOM is contenteditable' , ( ) => {
27+ editor . setUp ( '' ) ;
28+
29+ const contentDOM = window . editor . contentDOM ;
30+ expect ( contentDOM . getAttribute ( 'contenteditable' ) ) . toBe ( 'true' ) ;
31+ } ) ;
32+ } ) ;
You can’t perform that action at this time.
0 commit comments