File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
core/src/components/alert Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -400,7 +400,34 @@ export class Alert implements ComponentInterface, OverlayInterface {
400400
401401 await this . delegateController . attachViewToDom ( ) ;
402402
403- await present ( this , 'alertEnter' , iosEnterAnimation , mdEnterAnimation ) ;
403+ const ariaDescribedBy = this . el . getAttribute ( 'aria-describedby' ) ;
404+ const ariaLabelledBy = this . el . getAttribute ( 'aria-labelledby' ) ;
405+
406+ if ( ariaDescribedBy ) {
407+ this . el . removeAttribute ( 'aria-describedby' ) ;
408+ }
409+
410+ if ( ariaLabelledBy ) {
411+ this . el . removeAttribute ( 'aria-labelledby' ) ;
412+ }
413+
414+ await present ( this , 'alertEnter' , iosEnterAnimation , mdEnterAnimation ) . then ( ( ) => {
415+ const firstButton =
416+ this . el . querySelector < HTMLElement > ( '.alert-button-role-cancel' ) ||
417+ this . el . querySelector < HTMLElement > ( '.alert-button' ) ;
418+
419+ if ( firstButton ) {
420+ firstButton . focus ( ) ;
421+ }
422+
423+ if ( ariaDescribedBy ) {
424+ this . el . setAttribute ( 'aria-describedby' , ariaDescribedBy ) ;
425+ }
426+
427+ if ( ariaLabelledBy ) {
428+ this . el . setAttribute ( 'aria-labelledby' , ariaLabelledBy ) ;
429+ }
430+ } ) ;
404431
405432 unlock ( ) ;
406433 }
You can’t perform that action at this time.
0 commit comments