Skip to content
This repository was archived by the owner on Nov 6, 2019. It is now read-only.

Steps to adding accessibility to Phosphor #392

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
646204a
Adds the menubar role.
zorkow May 15, 2019
2f8511d
Adds initial set of aria roles to the menu.
zorkow May 15, 2019
bd603a6
Refactors Aria Attributes into separate type.
zorkow May 15, 2019
9138f6d
Adds Aria attributes to be treated special.
zorkow May 15, 2019
e3d046a
Adds roles and popup to all menu items. Corrects separator.
zorkow May 15, 2019
7ee92fb
Change to seperator role.
zorkow May 16, 2019
780f296
Add all ARIA attributes from the standard.
jasongrout May 16, 2019
94b7612
Add tab and tablist ARIA attributes for tabs.
jasongrout May 16, 2019
83cad0f
Add tab aria attributes in constructor.
jasongrout May 16, 2019
22ae364
Initial draft of adding tabpanel aria data for tabpanel and dockpanel.
jasongrout May 16, 2019
bc3c009
Add aria-label and aria-selected to tab bars.
jasongrout May 16, 2019
6b85946
Merge pull request #2 from jasongrout/aria_roles
jasongrout May 16, 2019
50ee3c3
Remove aria-controls.
jasongrout May 16, 2019
0721062
Add tab bar names, and default to “Activities <number>” for dockpanel.
jasongrout May 16, 2019
370ff66
Merge branch 'aria_roles' of github.com:diagram-codesprint/phosphor i…
jasongrout May 16, 2019
7f0cb21
Keep application-specific things out of phosphor.
jasongrout May 16, 2019
9761aee
Clean up tab panel adding widget ids and assuming tab bars are rendered.
jasongrout May 17, 2019
eb3b6a2
Add isToggleable command state
jasongrout May 17, 2019
fe9eabf
Fix typo
jasongrout May 17, 2019
953f2f0
Fix formatting and variable names.
jasongrout May 17, 2019
8abf54a
Revert changes to default tab renderer and tab type parameters.
jasongrout May 17, 2019
5a6b022
Add documentation for createTabKey.
jasongrout May 17, 2019
c6cae4a
Always set the aria attributes for a tab panel.
jasongrout May 17, 2019
fd4f2b1
Add two TODO notes about where the tab aria-selected state might need…
jasongrout May 17, 2019
025074d
Merge pull request #3 from diagram-codesprint/aria_roles
diagram-codesprint Jun 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds roles and popup to all menu items. Corrects separator.
  • Loading branch information
zorkow committed May 15, 2019
commit e3d046a4176ba7cf90b318da35521bb7528d3267
20 changes: 18 additions & 2 deletions packages/widgets/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from '@phosphor/signaling';

import {
ElementDataset, VirtualDOM, VirtualElement, h
ElementAriaAttrs, ElementDataset, VirtualDOM, VirtualElement, h
} from '@phosphor/virtualdom';

import {
Expand Down Expand Up @@ -1143,8 +1143,9 @@ namespace Menu {
renderItem(data: IRenderData): VirtualElement {
let className = this.createItemClass(data);
let dataset = this.createItemDataset(data);
let aria = this.createItemAria(data);
return (
h.li({ className, dataset, role: 'menuitem' },
h.li({ className, dataset, aria },
this.renderIcon(data),
this.renderLabel(data),
this.renderShortcut(data),
Expand Down Expand Up @@ -1269,6 +1270,21 @@ namespace Menu {
return extra ? `${name} ${extra}` : name;
}

createItemAria(data: IRenderData): ElementAriaAttrs {
let aria: any = {};
switch (data.item.type) {
case 'separator':
aria.role = 'separator';
break;
case 'submenu':
aria['aria-haspopup'] = true;
break;
default:
aria.role = 'menuitem';
}
return aria;
}

/**
* Create the render content for the label node.
*
Expand Down
9 changes: 7 additions & 2 deletions packages/widgets/src/menubar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from '@phosphor/messaging';

import {
ElementDataset, VirtualDOM, VirtualElement, h
ElementAriaAttrs, ElementDataset, VirtualDOM, VirtualElement, h
} from '@phosphor/virtualdom';

import {
Expand Down Expand Up @@ -748,8 +748,9 @@ namespace MenuBar {
renderItem(data: IRenderData): VirtualElement {
let className = this.createItemClass(data);
let dataset = this.createItemDataset(data);
let aria = this.createItemAria(data);
return (
h.li({ className, dataset, role: 'menuitem', 'aria-haspopup': 'true' },
h.li({ className, aria, dataset},
this.renderIcon(data),
this.renderLabel(data)
)
Expand Down Expand Up @@ -809,6 +810,10 @@ namespace MenuBar {
return data.title.dataset;
}

createItemAria(data: IRenderData): ElementAriaAttrs {
return {role: 'menuitem', 'aria-haspopup': 'true'};
}

/**
* Create the class name for the menu bar item icon.
*
Expand Down