Skip to content

Commit

Permalink
Added "tabindex=0" for sidebar accessibility (#583)
Browse files Browse the repository at this point in the history
* Added tabindex=0 for screen reader accessibility

* modified createTabARIA to include BaseAttrs; removed duplicate of tabindex in virtualdom

* Update API summary

---------

Co-authored-by: krassowski <5832902+krassowski@users.noreply.github.com>
  • Loading branch information
j264415 and krassowski authored May 20, 2023
1 parent f904a6b commit 57a7cbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions packages/widgets/src/tabbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { ISignal, Signal } from '@lumino/signaling';

import {
ElementARIAAttrs,
ElementBaseAttrs,
ElementDataset,
ElementInlineStyle,
h,
Expand Down Expand Up @@ -1666,8 +1667,12 @@ export namespace TabBar {
*
* @returns The ARIA attributes for the tab.
*/
createTabARIA(data: IRenderData<any>): ElementARIAAttrs {
return { role: 'tab', 'aria-selected': data.current.toString() };
createTabARIA(data: IRenderData<any>): ElementARIAAttrs | ElementBaseAttrs {
return {
role: 'tab',
'aria-selected': data.current.toString(),
tabindex: '0'
};
}

/**
Expand Down
3 changes: 2 additions & 1 deletion review/api/widgets.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { CommandRegistry } from '@lumino/commands';
import { ConflatableMessage } from '@lumino/messaging';
import { ElementARIAAttrs } from '@lumino/virtualdom';
import { ElementBaseAttrs } from '@lumino/virtualdom';
import { ElementDataset } from '@lumino/virtualdom';
import { ElementInlineStyle } from '@lumino/virtualdom';
import { h } from '@lumino/virtualdom';
Expand Down Expand Up @@ -1151,7 +1152,7 @@ export namespace TabBar {
constructor();
readonly closeIconSelector = ".lm-TabBar-tabCloseIcon";
createIconClass(data: IRenderData<any>): string;
createTabARIA(data: IRenderData<any>): ElementARIAAttrs;
createTabARIA(data: IRenderData<any>): ElementARIAAttrs | ElementBaseAttrs;
createTabClass(data: IRenderData<any>): string;
createTabDataset(data: IRenderData<any>): ElementDataset;
createTabKey(data: IRenderData<any>): string;
Expand Down

0 comments on commit 57a7cbc

Please sign in to comment.