File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
packages/govuk-frontend/src/govuk/components/service-navigation Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -49,12 +49,13 @@ export class ServiceNavigation extends Component {
4949 return this
5050 }
5151
52- const menuId = $menuButton . getAttribute ( 'aria-controls' )
52+ const menuId = $menuButton . getAttribute ( 'data-aria-controls' )
53+
5354 if ( ! menuId ) {
5455 throw new ElementError ( {
5556 component : ServiceNavigation ,
5657 identifier :
57- 'Navigation button (`<button class="govuk-js-service-navigation-toggle">`) attribute (`aria-controls`)'
58+ 'Navigation button (`<button class="govuk-js-service-navigation-toggle">`) attribute (`data- aria-controls`)'
5859 } )
5960 }
6061
@@ -126,9 +127,15 @@ export class ServiceNavigation extends Component {
126127 if ( this . mql . matches ) {
127128 this . $menu . removeAttribute ( 'hidden' )
128129 this . $menuButton . setAttribute ( 'hidden' , '' )
130+ // Voice Over keeps the button listed in its Form Controls rotor
131+ // https://bugs.webkit.org/show_bug.cgi?id=300899
132+ this . $menuButton . removeAttribute ( 'aria-controls' )
129133 } else {
130134 this . $menuButton . removeAttribute ( 'hidden' )
131135 this . $menuButton . setAttribute ( 'aria-expanded' , this . menuIsOpen . toString ( ) )
136+ // Voice Over keeps the button listed in its Form Controls rotor
137+ // https://bugs.webkit.org/show_bug.cgi?id=300899
138+ this . $menuButton . setAttribute ( 'aria-controls' , this . $menu . id )
132139
133140 if ( this . menuIsOpen ) {
134141 this . $menu . removeAttribute ( 'hidden' )
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ data-module="govuk-service-navigation"
3737 {% if navigationItems | length or params .slots .navigationStart or params .slots .navigationEnd %}
3838 <nav aria-label =" {{ params.navigationLabel | default(menuButtonText, true) }}" class =" govuk-service-navigation__wrapper {%- if params.navigationClasses %} {{ params.navigationClasses }}{% endif %}" >
3939 {% if collapseNavigationOnMobile %}
40- <button type =" button" class =" govuk-service-navigation__toggle govuk-js-service-navigation-toggle" aria-controls =" {{ navigationId }}" {%- if params.menuButtonLabel and params.menuButtonLabel ! = menuButtonText %} aria-label =" {{ params.menuButtonLabel }}" {% endif %} hidden >
40+ <button type =" button" class =" govuk-service-navigation__toggle govuk-js-service-navigation-toggle" data- aria-controls =" {{ navigationId }}" {%- if params.menuButtonLabel and params.menuButtonLabel ! = menuButtonText %} aria-label =" {{ params.menuButtonLabel }}" {% endif %} hidden >
4141 {{ menuButtonText }}
4242 </button >
4343 {% endif %}
You can’t perform that action at this time.
0 commit comments