File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -697,11 +697,8 @@ class Popover extends PopoverPositionMixin(
697697
698698 effectiveTarget . setAttribute ( 'aria-expanded' , opened ? 'true' : 'false' ) ;
699699
700- if ( opened ) {
701- effectiveTarget . setAttribute ( 'aria-controls' , this . id ) ;
702- } else {
703- effectiveTarget . removeAttribute ( 'aria-controls' ) ;
704- }
700+ // Always set aria-controls to make VoiceOver + Chrome announce it.
701+ effectiveTarget . setAttribute ( 'aria-controls' , this . id ) ;
705702
706703 this . __oldTarget = target ;
707704 }
Original file line number Diff line number Diff line change @@ -130,19 +130,17 @@ describe('a11y', () => {
130130 expect ( element . getAttribute ( 'aria-expanded' ) ) . to . equal ( 'true' ) ;
131131 } ) ;
132132
133- it ( `should set aria-controls attribute on the ${ prop } when opened` , async ( ) => {
134- popover . opened = true ;
135- await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
133+ it ( `should set aria-controls attribute on the ${ prop } by default` , ( ) => {
136134 expect ( element . getAttribute ( 'aria-controls' ) ) . to . equal ( popover . id ) ;
137135 } ) ;
138136
139- it ( `should remove aria-controls attribute from the ${ prop } when closed` , async ( ) => {
137+ it ( `should keep aria-controls attribute on the ${ prop } when closed` , async ( ) => {
140138 popover . opened = true ;
141139 await oneEvent ( overlay , 'vaadin-overlay-open' ) ;
142140
143141 popover . opened = false ;
144142 await nextUpdate ( popover ) ;
145- expect ( element . hasAttribute ( 'aria-controls' ) ) . to . be . false ;
143+ expect ( element . getAttribute ( 'aria-controls' ) ) . to . equal ( popover . id ) ;
146144 } ) ;
147145
148146 it ( `should remove aria-haspopup attribute from ${ prop } when target is cleared` , async ( ) => {
You can’t perform that action at this time.
0 commit comments