@@ -36,7 +36,9 @@ import { roles as roles_map, aria } from 'aria-query';
3636import { AXObjectRoles , elementAXObjects } from 'axobject-query' ;
3737import {
3838 regex_heading_tags ,
39+ regex_js_prefix ,
3940 regex_not_whitespace ,
41+ regex_redundant_img_alt ,
4042 regex_starts_with_vowel ,
4143 regex_whitespaces
4244} from '../../../../patterns.js' ;
@@ -533,7 +535,9 @@ export function check_element(node, context) {
533535 }
534536 // no-autofocus
535537 case 'autofocus' : {
536- w . a11y_autofocus ( attribute ) ;
538+ if ( node . name !== 'dialog' && ! is_parent ( context . path , [ 'dialog' ] ) ) {
539+ w . a11y_autofocus ( attribute ) ;
540+ }
537541 break ;
538542 }
539543 // scope
@@ -673,7 +677,7 @@ export function check_element(node, context) {
673677 if ( href ) {
674678 const href_value = get_static_text_value ( href ) ;
675679 if ( href_value !== null ) {
676- if ( href_value === '' || href_value === '#' || / ^ \W * j a v a s c r i p t : / i . test ( href_value ) ) {
680+ if ( href_value === '' || href_value === '#' || regex_js_prefix . test ( href_value ) ) {
677681 w . a11y_invalid_attribute ( href , href_value , href . name ) ;
678682 }
679683 }
@@ -715,7 +719,7 @@ export function check_element(node, context) {
715719 const alt_attribute = get_static_text_value ( attribute_map . get ( 'alt' ) ) ;
716720 const aria_hidden = get_static_value ( attribute_map . get ( 'aria-hidden' ) ) ;
717721 if ( alt_attribute && ! aria_hidden && ! has_spread ) {
718- if ( / \b ( i m a g e | p i c t u r e | p h o t o ) \b / i . test ( alt_attribute ) ) {
722+ if ( regex_redundant_img_alt . test ( alt_attribute ) ) {
719723 w . a11y_img_redundant_alt ( node ) ;
720724 }
721725 }
0 commit comments