pull/8025/head
Yuichiro Yamashita 4 years ago
parent b4986ea691
commit e8f5ae1e53

@ -7,17 +7,17 @@ import {
import { AXObjects, AXObjectRoles, elementAXObjects } from 'axobject-query'; import { AXObjects, AXObjectRoles, elementAXObjects } from 'axobject-query';
import Attribute from '../nodes/Attribute'; import Attribute from '../nodes/Attribute';
const roles = [...roles_map.keys()]; const non_abstract_roles = [...roles_map.keys()].filter((name) => !roles_map.get(name).abstract);
const non_interactive_roles = new Set( const non_interactive_roles = new Set(
roles non_abstract_roles
.filter((name) => { .filter((name) => {
const role = roles_map.get(name); const role = roles_map.get(name);
return ( return (
!roles_map.get(name).abstract &&
// 'toolbar' does not descend from widget, but it does support // 'toolbar' does not descend from widget, but it does support
// aria-activedescendant, thus in practice we treat it as a widget. // aria-activedescendant, thus in practice we treat it as a widget.
name !== 'toolbar' && // focusable tabpanel elements are recommended if any panels in a set contain content where the first element in the panel is not focusable.
!['toolbar', 'tabpanel'].includes(name) &&
!role.superClass.some((classes) => classes.includes('widget')) !role.superClass.some((classes) => classes.includes('widget'))
); );
}) })
@ -29,24 +29,7 @@ const non_interactive_roles = new Set(
); );
const interactive_roles = new Set( const interactive_roles = new Set(
roles non_abstract_roles.filter((name) => !non_interactive_roles.has(name))
.filter((name) => {
const role = roles_map.get(name);
return (
!role.abstract &&
// The `progressbar` is descended from `widget`, but in practice, its
// value is always `readonly`, so we treat it as a non-interactive role.
name !== 'progressbar' &&
role.superClass.some((classes) => classes.includes('widget'))
);
})
.concat(
// 'toolbar' does not descend from widget, but it does support
// aria-activedescendant, thus in practice we treat it as a widget.
'toolbar',
//focusable tabpanel elements are recommended if any panels in a set contain content where the first element in the panel is not focusable.
'tabpanel'
)
); );
export function is_non_interactive_roles(role: ARIARoleDefintionKey) { export function is_non_interactive_roles(role: ARIARoleDefintionKey) {

@ -13,5 +13,3 @@
<div role='article' tabindex='0' /> <div role='article' tabindex='0' />
<article tabindex='0' /> <article tabindex='0' />
<article tabindex='{0}' /> <article tabindex='{0}' />

Loading…
Cancel
Save