mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-23 15:26:47 +00:00
Add enter/spacebar keyboard support to sidebar.
Bug: T255727 Depends-On: I388ac873997aa02d713ae7453216e0cb7d983993 Change-Id: Ie438db4f752c77aa40191d2bceb83f52d3371c6c
This commit is contained in:
parent
1fac82f895
commit
2b5857f624
1
resources/CheckboxHack.d.ts
vendored
1
resources/CheckboxHack.d.ts
vendored
|
@ -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;
|
||||
|
|
|
@ -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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue