diff --git a/resources/CheckboxHack.d.ts b/resources/CheckboxHack.d.ts index 23f774bd4..13c17bfb9 100644 --- a/resources/CheckboxHack.d.ts +++ b/resources/CheckboxHack.d.ts @@ -2,6 +2,7 @@ interface CheckboxHack { updateAriaExpanded(checkbox: HTMLInputElement, button: HTMLElement): void; bindUpdateAriaExpandedOnInput(checkbox: HTMLInputElement, button: HTMLElement): CheckboxHackListeners; bindToggleOnClick(checkbox: HTMLInputElement, button: HTMLElement): CheckboxHackListeners; + bindToggleOnSpaceEnter(checkbox:HTMLInputElement, button:HTMLElement): CheckboxHackListeners; bindDismissOnClickOutside(window: Window, checkbox: HTMLInputElement, button: HTMLElement, target: Node): CheckboxHackListeners; bindDismissOnFocusLoss(window: Window, checkbox: HTMLInputElement, button: HTMLElement, target: Node): CheckboxHackListeners; bind(window: Window, checkbox: HTMLInputElement, button: HTMLElement, target: Node): CheckboxHackListeners; diff --git a/resources/skins.vector.js/sidebar.js b/resources/skins.vector.js/sidebar.js index b2939fede..cdc106e3e 100644 --- a/resources/skins.vector.js/sidebar.js +++ b/resources/skins.vector.js/sidebar.js @@ -37,6 +37,7 @@ function initCheckboxHack( checkbox, button ) { checkboxHack.bindToggleOnClick( checkbox, button ); checkboxHack.bindUpdateAriaExpandedOnInput( checkbox, button ); checkboxHack.updateAriaExpanded( checkbox, button ); + checkboxHack.bindToggleOnSpaceEnter( checkbox, button ); } } @@ -64,7 +65,7 @@ function saveSidebarState( checkbox ) { */ function bindSidebarClickEvent( checkbox, button ) { if ( checkbox instanceof HTMLInputElement && button ) { - button.addEventListener( 'click', saveSidebarState( checkbox ) ); + checkbox.addEventListener( 'input', saveSidebarState( checkbox ) ); } }