File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/js/_enqueues/wp/customize Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 40754075 toggle = control . container . find ( '.add-new-toggle' ) ;
40764076 container = control . container . find ( '.new-content-item-wrapper' ) ;
40774077 input = control . container . find ( '.create-item-input' ) ;
4078+ inputError = control . container . find ( '.create-item-error' ) ;
40784079 title = input . val ( ) ;
40794080 select = control . container . find ( 'select' ) ;
40804081
40814082 if ( ! title ) {
4082- input . addClass ( 'invalid' ) ;
4083+ container . addClass ( 'form-invalid' ) ;
4084+ input . attr ( 'aria-invalid' , 'true' ) ;
4085+ input . attr ( 'aria-describedby' , inputError . attr ( 'id' ) ) ;
4086+ inputError . show ( ) ;
4087+ wp . a11y . speak ( inputError . text ( ) ) ;
40834088 return ;
40844089 }
40854090
4086- input . removeClass ( 'invalid' ) ;
4091+ input . removeClass ( 'form-invalid' ) ;
4092+ input . attr ( 'aria-invalid' , 'false' ) ;
4093+ input . removeAttr ( 'aria-describedby' ) ;
4094+ inputError . hide ( ) ;
40874095 input . attr ( 'disabled' , 'disabled' ) ;
40884096
40894097 // The menus functions add the page, publish when appropriate,
You can’t perform that action at this time.
0 commit comments