aria-roles.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835
  1. // Source: https://www.w3.org/TR/wai-aria-1.1/#roles
  2. /* easiest way to see allowed roles is to filter out the global ones
  3. from the list of inherited states and properties. The dpub spec
  4. does not have the global list so you'll need to copy over from
  5. the wai-aria one:
  6. const globalAttrs = Array.from(
  7. document.querySelectorAll('#global_states li')
  8. ).map(li => li.textContent.replace(/\s*\(.*\)/, ''));
  9. const globalRoleAttrs = Array.from(
  10. document.querySelectorAll('.role-inherited li')
  11. ).filter(li => globalAttrs.includes(li.textContent.replace(/\s*\(.*\)/, '')))
  12. globalRoleAttrs.forEach(li => li.style.display = 'none');
  13. */
  14. const ariaRoles = {
  15. alert: {
  16. type: 'widget',
  17. allowedAttrs: ['aria-expanded'],
  18. superclassRole: ['section']
  19. },
  20. alertdialog: {
  21. type: 'widget',
  22. allowedAttrs: ['aria-expanded', 'aria-modal'],
  23. superclassRole: ['alert', 'dialog'],
  24. accessibleNameRequired: true
  25. },
  26. application: {
  27. // Note: spec difference
  28. type: 'landmark',
  29. // Note: aria-expanded is not in the 1.1 spec but is
  30. // consistently supported in ATs and was added in 1.2
  31. allowedAttrs: ['aria-activedescendant', 'aria-expanded'],
  32. superclassRole: ['structure'],
  33. accessibleNameRequired: true
  34. },
  35. article: {
  36. type: 'structure',
  37. allowedAttrs: ['aria-posinset', 'aria-setsize', 'aria-expanded'],
  38. superclassRole: ['document']
  39. },
  40. banner: {
  41. type: 'landmark',
  42. allowedAttrs: ['aria-expanded'],
  43. superclassRole: ['landmark']
  44. },
  45. blockquote: {
  46. type: 'structure',
  47. superclassRole: ['section']
  48. },
  49. button: {
  50. type: 'widget',
  51. allowedAttrs: ['aria-expanded', 'aria-pressed'],
  52. superclassRole: ['command'],
  53. accessibleNameRequired: true,
  54. nameFromContent: true,
  55. childrenPresentational: true
  56. },
  57. caption: {
  58. type: 'structure',
  59. requiredContext: ['figure', 'table', 'grid', 'treegrid'],
  60. superclassRole: ['section'],
  61. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  62. },
  63. cell: {
  64. type: 'structure',
  65. requiredContext: ['row'],
  66. allowedAttrs: [
  67. 'aria-colindex',
  68. 'aria-colspan',
  69. 'aria-rowindex',
  70. 'aria-rowspan',
  71. 'aria-expanded'
  72. ],
  73. superclassRole: ['section'],
  74. nameFromContent: true
  75. },
  76. checkbox: {
  77. type: 'widget',
  78. // Note: since the checkbox role has an implicit
  79. // aria-checked value it is not required to be added by
  80. // the user
  81. //
  82. // Note: aria-required is not in the 1.1 spec but is
  83. // consistently supported in ATs and was added in 1.2
  84. allowedAttrs: ['aria-checked', 'aria-readonly', 'aria-required'],
  85. superclassRole: ['input'],
  86. accessibleNameRequired: true,
  87. nameFromContent: true,
  88. childrenPresentational: true
  89. },
  90. code: {
  91. type: 'structure',
  92. superclassRole: ['section'],
  93. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  94. },
  95. columnheader: {
  96. type: 'structure',
  97. requiredContext: ['row'],
  98. allowedAttrs: [
  99. 'aria-sort',
  100. 'aria-colindex',
  101. 'aria-colspan',
  102. 'aria-expanded',
  103. 'aria-readonly',
  104. 'aria-required',
  105. 'aria-rowindex',
  106. 'aria-rowspan',
  107. 'aria-selected'
  108. ],
  109. superclassRole: ['cell', 'gridcell', 'sectionhead'],
  110. // Note: spec difference
  111. accessibleNameRequired: false,
  112. nameFromContent: true
  113. },
  114. combobox: {
  115. type: 'composite',
  116. requiredOwned: ['listbox', 'tree', 'grid', 'dialog', 'textbox'],
  117. requiredAttrs: ['aria-expanded'],
  118. // Note: because aria-controls is not well supported we will not
  119. // make it a required attribute even though it is required in the
  120. // spec
  121. allowedAttrs: [
  122. 'aria-controls',
  123. 'aria-autocomplete',
  124. 'aria-readonly',
  125. 'aria-required',
  126. 'aria-activedescendant',
  127. 'aria-orientation'
  128. ],
  129. superclassRole: ['select'],
  130. accessibleNameRequired: true
  131. },
  132. command: {
  133. type: 'abstract',
  134. superclassRole: ['widget']
  135. },
  136. complementary: {
  137. type: 'landmark',
  138. allowedAttrs: ['aria-expanded'],
  139. superclassRole: ['landmark']
  140. },
  141. composite: {
  142. type: 'abstract',
  143. superclassRole: ['widget']
  144. },
  145. contentinfo: {
  146. type: 'landmark',
  147. allowedAttrs: ['aria-expanded'],
  148. superclassRole: ['landmark']
  149. },
  150. definition: {
  151. type: 'structure',
  152. allowedAttrs: ['aria-expanded'],
  153. superclassRole: ['section']
  154. },
  155. deletion: {
  156. type: 'structure',
  157. superclassRole: ['section'],
  158. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  159. },
  160. dialog: {
  161. type: 'widget',
  162. allowedAttrs: ['aria-expanded', 'aria-modal'],
  163. superclassRole: ['window'],
  164. accessibleNameRequired: true
  165. },
  166. directory: {
  167. type: 'structure',
  168. allowedAttrs: ['aria-expanded'],
  169. superclassRole: ['list'],
  170. // Note: spec difference
  171. nameFromContent: true
  172. },
  173. document: {
  174. type: 'structure',
  175. allowedAttrs: ['aria-expanded'],
  176. superclassRole: ['structure']
  177. },
  178. emphasis: {
  179. type: 'structure',
  180. superclassRole: ['section'],
  181. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  182. },
  183. feed: {
  184. type: 'structure',
  185. requiredOwned: ['article'],
  186. allowedAttrs: ['aria-expanded'],
  187. superclassRole: ['list']
  188. },
  189. figure: {
  190. type: 'structure',
  191. allowedAttrs: ['aria-expanded'],
  192. superclassRole: ['section'],
  193. // Note: spec difference
  194. nameFromContent: true
  195. },
  196. form: {
  197. type: 'landmark',
  198. allowedAttrs: ['aria-expanded'],
  199. superclassRole: ['landmark']
  200. },
  201. grid: {
  202. type: 'composite',
  203. requiredOwned: ['rowgroup', 'row'],
  204. allowedAttrs: [
  205. 'aria-level',
  206. 'aria-multiselectable',
  207. 'aria-readonly',
  208. 'aria-activedescendant',
  209. 'aria-colcount',
  210. 'aria-expanded',
  211. 'aria-rowcount'
  212. ],
  213. superclassRole: ['composite', 'table'],
  214. // Note: spec difference
  215. accessibleNameRequired: false
  216. },
  217. gridcell: {
  218. type: 'widget',
  219. requiredContext: ['row'],
  220. allowedAttrs: [
  221. 'aria-readonly',
  222. 'aria-required',
  223. 'aria-selected',
  224. 'aria-colindex',
  225. 'aria-colspan',
  226. 'aria-expanded',
  227. 'aria-rowindex',
  228. 'aria-rowspan'
  229. ],
  230. superclassRole: ['cell', 'widget'],
  231. nameFromContent: true
  232. },
  233. group: {
  234. type: 'structure',
  235. allowedAttrs: ['aria-activedescendant', 'aria-expanded'],
  236. superclassRole: ['section']
  237. },
  238. heading: {
  239. type: 'structure',
  240. requiredAttrs: ['aria-level'],
  241. allowedAttrs: ['aria-expanded'],
  242. superclassRole: ['sectionhead'],
  243. // Note: spec difference
  244. accessibleNameRequired: false,
  245. nameFromContent: true
  246. },
  247. img: {
  248. type: 'structure',
  249. allowedAttrs: ['aria-expanded'],
  250. superclassRole: ['section'],
  251. accessibleNameRequired: true,
  252. childrenPresentational: true
  253. },
  254. input: {
  255. type: 'abstract',
  256. superclassRole: ['widget']
  257. },
  258. insertion: {
  259. type: 'structure',
  260. superclassRole: ['section'],
  261. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  262. },
  263. landmark: {
  264. type: 'abstract',
  265. superclassRole: ['section']
  266. },
  267. link: {
  268. type: 'widget',
  269. allowedAttrs: ['aria-expanded'],
  270. superclassRole: ['command'],
  271. accessibleNameRequired: true,
  272. nameFromContent: true
  273. },
  274. list: {
  275. type: 'structure',
  276. requiredOwned: ['group', 'listitem'],
  277. allowedAttrs: ['aria-expanded'],
  278. superclassRole: ['section']
  279. },
  280. listbox: {
  281. type: 'composite',
  282. requiredOwned: ['option'],
  283. allowedAttrs: [
  284. 'aria-multiselectable',
  285. 'aria-readonly',
  286. 'aria-required',
  287. 'aria-activedescendant',
  288. 'aria-expanded',
  289. 'aria-orientation'
  290. ],
  291. superclassRole: ['select'],
  292. accessibleNameRequired: true
  293. },
  294. listitem: {
  295. type: 'structure',
  296. requiredContext: ['list', 'group'],
  297. allowedAttrs: [
  298. 'aria-level',
  299. 'aria-posinset',
  300. 'aria-setsize',
  301. 'aria-expanded'
  302. ],
  303. superclassRole: ['section'],
  304. // Note: spec difference
  305. nameFromContent: true
  306. },
  307. log: {
  308. type: 'widget',
  309. allowedAttrs: ['aria-expanded'],
  310. superclassRole: ['section']
  311. },
  312. main: {
  313. type: 'landmark',
  314. allowedAttrs: ['aria-expanded'],
  315. superclassRole: ['landmark']
  316. },
  317. marquee: {
  318. type: 'widget',
  319. allowedAttrs: ['aria-expanded'],
  320. superclassRole: ['section']
  321. },
  322. math: {
  323. type: 'structure',
  324. allowedAttrs: ['aria-expanded'],
  325. superclassRole: ['section'],
  326. childrenPresentational: true
  327. },
  328. menu: {
  329. type: 'composite',
  330. requiredOwned: ['group', 'menuitemradio', 'menuitem', 'menuitemcheckbox'],
  331. allowedAttrs: [
  332. 'aria-activedescendant',
  333. 'aria-expanded',
  334. 'aria-orientation'
  335. ],
  336. superclassRole: ['select']
  337. },
  338. menubar: {
  339. type: 'composite',
  340. requiredOwned: ['group', 'menuitemradio', 'menuitem', 'menuitemcheckbox'],
  341. allowedAttrs: [
  342. 'aria-activedescendant',
  343. 'aria-expanded',
  344. 'aria-orientation'
  345. ],
  346. superclassRole: ['menu']
  347. },
  348. menuitem: {
  349. type: 'widget',
  350. requiredContext: ['menu', 'menubar', 'group'],
  351. // Note: aria-expanded is not in the 1.1 spec but is
  352. // consistently supported in ATs and was added in 1.2
  353. allowedAttrs: ['aria-posinset', 'aria-setsize', 'aria-expanded'],
  354. superclassRole: ['command'],
  355. accessibleNameRequired: true,
  356. nameFromContent: true
  357. },
  358. menuitemcheckbox: {
  359. type: 'widget',
  360. requiredContext: ['menu', 'menubar', 'group'],
  361. allowedAttrs: [
  362. 'aria-checked',
  363. 'aria-posinset',
  364. 'aria-readonly',
  365. 'aria-setsize'
  366. ],
  367. superclassRole: ['checkbox', 'menuitem'],
  368. accessibleNameRequired: true,
  369. nameFromContent: true,
  370. childrenPresentational: true
  371. },
  372. menuitemradio: {
  373. type: 'widget',
  374. requiredContext: ['menu', 'menubar', 'group'],
  375. allowedAttrs: [
  376. 'aria-checked',
  377. 'aria-posinset',
  378. 'aria-readonly',
  379. 'aria-setsize'
  380. ],
  381. superclassRole: ['menuitemcheckbox', 'radio'],
  382. accessibleNameRequired: true,
  383. nameFromContent: true,
  384. childrenPresentational: true
  385. },
  386. meter: {
  387. type: 'structure',
  388. allowedAttrs: ['aria-valuetext'],
  389. requiredAttrs: ['aria-valuemax', 'aria-valuemin', 'aria-valuenow'],
  390. superclassRole: ['range'],
  391. accessibleNameRequired: true,
  392. childrenPresentational: true
  393. },
  394. navigation: {
  395. type: 'landmark',
  396. allowedAttrs: ['aria-expanded'],
  397. superclassRole: ['landmark']
  398. },
  399. none: {
  400. type: 'structure',
  401. superclassRole: ['structure'],
  402. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  403. },
  404. note: {
  405. type: 'structure',
  406. allowedAttrs: ['aria-expanded'],
  407. superclassRole: ['section']
  408. },
  409. option: {
  410. type: 'widget',
  411. requiredContext: ['listbox'],
  412. // Note: since the option role has an implicit
  413. // aria-selected value it is not required to be added by
  414. // the user
  415. allowedAttrs: [
  416. 'aria-selected',
  417. 'aria-checked',
  418. 'aria-posinset',
  419. 'aria-setsize'
  420. ],
  421. superclassRole: ['input'],
  422. accessibleNameRequired: true,
  423. nameFromContent: true,
  424. childrenPresentational: true
  425. },
  426. paragraph: {
  427. type: 'structure',
  428. superclassRole: ['section'],
  429. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  430. },
  431. presentation: {
  432. type: 'structure',
  433. superclassRole: ['structure'],
  434. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  435. },
  436. progressbar: {
  437. type: 'widget',
  438. allowedAttrs: [
  439. 'aria-expanded',
  440. 'aria-valuemax',
  441. 'aria-valuemin',
  442. 'aria-valuenow',
  443. 'aria-valuetext'
  444. ],
  445. superclassRole: ['range'],
  446. accessibleNameRequired: true,
  447. childrenPresentational: true
  448. },
  449. radio: {
  450. type: 'widget',
  451. // Note: since the radio role has an implicit
  452. // aria-check value it is not required to be added by
  453. // the user
  454. //
  455. // Note: aria-required is not in the 1.1 or 1.2 specs but is
  456. // consistently supported in ATs on the individual radio element
  457. allowedAttrs: [
  458. 'aria-checked',
  459. 'aria-posinset',
  460. 'aria-setsize',
  461. 'aria-required'
  462. ],
  463. superclassRole: ['input'],
  464. accessibleNameRequired: true,
  465. nameFromContent: true,
  466. childrenPresentational: true
  467. },
  468. radiogroup: {
  469. type: 'composite',
  470. requiredOwned: ['radio'],
  471. allowedAttrs: [
  472. 'aria-readonly',
  473. 'aria-required',
  474. 'aria-activedescendant',
  475. 'aria-expanded',
  476. 'aria-orientation'
  477. ],
  478. superclassRole: ['select'],
  479. // Note: spec difference
  480. accessibleNameRequired: false
  481. },
  482. range: {
  483. type: 'abstract',
  484. superclassRole: ['widget']
  485. },
  486. region: {
  487. type: 'landmark',
  488. allowedAttrs: ['aria-expanded'],
  489. superclassRole: ['landmark'],
  490. // Note: spec difference
  491. accessibleNameRequired: false
  492. },
  493. roletype: {
  494. type: 'abstract',
  495. superclassRole: []
  496. },
  497. row: {
  498. type: 'structure',
  499. requiredContext: ['grid', 'rowgroup', 'table', 'treegrid'],
  500. requiredOwned: ['cell', 'columnheader', 'gridcell', 'rowheader'],
  501. allowedAttrs: [
  502. 'aria-colindex',
  503. 'aria-level',
  504. 'aria-rowindex',
  505. 'aria-selected',
  506. 'aria-activedescendant',
  507. 'aria-expanded',
  508. 'aria-posinset',
  509. 'aria-setsize'
  510. ],
  511. superclassRole: ['group', 'widget'],
  512. nameFromContent: true
  513. },
  514. rowgroup: {
  515. type: 'structure',
  516. requiredContext: ['grid', 'table', 'treegrid'],
  517. requiredOwned: ['row'],
  518. superclassRole: ['structure'],
  519. nameFromContent: true
  520. },
  521. rowheader: {
  522. type: 'structure',
  523. requiredContext: ['row'],
  524. allowedAttrs: [
  525. 'aria-sort',
  526. 'aria-colindex',
  527. 'aria-colspan',
  528. 'aria-expanded',
  529. 'aria-readonly',
  530. 'aria-required',
  531. 'aria-rowindex',
  532. 'aria-rowspan',
  533. 'aria-selected'
  534. ],
  535. superclassRole: ['cell', 'gridcell', 'sectionhead'],
  536. // Note: spec difference
  537. accessibleNameRequired: false,
  538. nameFromContent: true
  539. },
  540. scrollbar: {
  541. type: 'widget',
  542. requiredAttrs: ['aria-valuenow'],
  543. // Note: since the scrollbar role has implicit
  544. // aria-orientation, aria-valuemax, aria-valuemin values it
  545. // is not required to be added by the user
  546. //
  547. // Note: because aria-controls is not well supported we will not
  548. // make it a required attribute even though it is required in the
  549. // spec
  550. allowedAttrs: [
  551. 'aria-controls',
  552. 'aria-orientation',
  553. 'aria-valuemax',
  554. 'aria-valuemin',
  555. 'aria-valuetext'
  556. ],
  557. superclassRole: ['range'],
  558. childrenPresentational: true
  559. },
  560. search: {
  561. type: 'landmark',
  562. allowedAttrs: ['aria-expanded'],
  563. superclassRole: ['landmark']
  564. },
  565. searchbox: {
  566. type: 'widget',
  567. allowedAttrs: [
  568. 'aria-activedescendant',
  569. 'aria-autocomplete',
  570. 'aria-multiline',
  571. 'aria-placeholder',
  572. 'aria-readonly',
  573. 'aria-required'
  574. ],
  575. superclassRole: ['textbox'],
  576. accessibleNameRequired: true
  577. },
  578. section: {
  579. type: 'abstract',
  580. superclassRole: ['structure'],
  581. // Note: spec difference
  582. nameFromContent: true
  583. },
  584. sectionhead: {
  585. type: 'abstract',
  586. superclassRole: ['structure'],
  587. // Note: spec difference
  588. nameFromContent: true
  589. },
  590. select: {
  591. type: 'abstract',
  592. superclassRole: ['composite', 'group']
  593. },
  594. separator: {
  595. type: 'structure',
  596. // Note: since the separator role has implicit
  597. // aria-orientation, aria-valuemax, aria-valuemin, and
  598. // aria-valuenow values it is not required to be added by
  599. // the user
  600. allowedAttrs: [
  601. 'aria-valuemax',
  602. 'aria-valuemin',
  603. 'aria-valuenow',
  604. 'aria-orientation',
  605. 'aria-valuetext'
  606. ],
  607. superclassRole: ['structure', 'widget'],
  608. childrenPresentational: true
  609. },
  610. slider: {
  611. type: 'widget',
  612. requiredAttrs: ['aria-valuenow'],
  613. // Note: since the slider role has implicit
  614. // aria-orientation, aria-valuemax, aria-valuemin values it
  615. // is not required to be added by the user
  616. allowedAttrs: [
  617. 'aria-valuemax',
  618. 'aria-valuemin',
  619. 'aria-orientation',
  620. 'aria-readonly',
  621. 'aria-valuetext'
  622. ],
  623. superclassRole: ['input', 'range'],
  624. accessibleNameRequired: true,
  625. childrenPresentational: true
  626. },
  627. spinbutton: {
  628. type: 'widget',
  629. requiredAttrs: ['aria-valuenow'],
  630. // Note: since the spinbutton role has implicit
  631. // aria-orientation, aria-valuemax, aria-valuemin values it
  632. // is not required to be added by the user
  633. allowedAttrs: [
  634. 'aria-valuemax',
  635. 'aria-valuemin',
  636. 'aria-readonly',
  637. 'aria-required',
  638. 'aria-activedescendant',
  639. 'aria-valuetext'
  640. ],
  641. superclassRole: ['composite', 'input', 'range'],
  642. accessibleNameRequired: true
  643. },
  644. status: {
  645. type: 'widget',
  646. allowedAttrs: ['aria-expanded'],
  647. superclassRole: ['section']
  648. },
  649. strong: {
  650. type: 'structure',
  651. superclassRole: ['section'],
  652. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  653. },
  654. structure: {
  655. type: 'abstract',
  656. superclassRole: ['roletype']
  657. },
  658. subscript: {
  659. type: 'structure',
  660. superclassRole: ['section'],
  661. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  662. },
  663. superscript: {
  664. type: 'structure',
  665. superclassRole: ['section'],
  666. prohibitedAttrs: ['aria-label', 'aria-labelledby']
  667. },
  668. switch: {
  669. type: 'widget',
  670. requiredAttrs: ['aria-checked'],
  671. allowedAttrs: ['aria-readonly'],
  672. superclassRole: ['checkbox'],
  673. accessibleNameRequired: true,
  674. nameFromContent: true,
  675. childrenPresentational: true
  676. },
  677. tab: {
  678. type: 'widget',
  679. requiredContext: ['tablist'],
  680. allowedAttrs: [
  681. 'aria-posinset',
  682. 'aria-selected',
  683. 'aria-setsize',
  684. 'aria-expanded'
  685. ],
  686. superclassRole: ['sectionhead', 'widget'],
  687. nameFromContent: true,
  688. childrenPresentational: true
  689. },
  690. table: {
  691. type: 'structure',
  692. requiredOwned: ['rowgroup', 'row'],
  693. allowedAttrs: ['aria-colcount', 'aria-rowcount', 'aria-expanded'],
  694. // NOTE: although the spec says this is not named from contents,
  695. // the accessible text acceptance tests (#139 and #140) require
  696. // table be named from content (we even had to special case
  697. // table in commons/aria/named-from-contents)
  698. superclassRole: ['section'],
  699. // Note: spec difference
  700. accessibleNameRequired: false,
  701. nameFromContent: true
  702. },
  703. tablist: {
  704. type: 'composite',
  705. requiredOwned: ['tab'],
  706. // NOTE: aria-expanded is from the 1.0 spec but is still
  707. // consistently supported in ATs
  708. allowedAttrs: [
  709. 'aria-level',
  710. 'aria-multiselectable',
  711. 'aria-orientation',
  712. 'aria-activedescendant',
  713. 'aria-expanded'
  714. ],
  715. superclassRole: ['composite']
  716. },
  717. tabpanel: {
  718. type: 'widget',
  719. allowedAttrs: ['aria-expanded'],
  720. superclassRole: ['section'],
  721. // Note: spec difference
  722. accessibleNameRequired: false
  723. },
  724. term: {
  725. type: 'structure',
  726. allowedAttrs: ['aria-expanded'],
  727. superclassRole: ['section'],
  728. // Note: spec difference
  729. nameFromContent: true
  730. },
  731. text: {
  732. type: 'structure',
  733. superclassRole: ['section'],
  734. nameFromContent: true
  735. },
  736. textbox: {
  737. type: 'widget',
  738. allowedAttrs: [
  739. 'aria-activedescendant',
  740. 'aria-autocomplete',
  741. 'aria-multiline',
  742. 'aria-placeholder',
  743. 'aria-readonly',
  744. 'aria-required'
  745. ],
  746. superclassRole: ['input'],
  747. accessibleNameRequired: true
  748. },
  749. time: {
  750. type: 'structure',
  751. superclassRole: ['section']
  752. },
  753. timer: {
  754. type: 'widget',
  755. allowedAttrs: ['aria-expanded'],
  756. superclassRole: ['status']
  757. },
  758. toolbar: {
  759. type: 'structure',
  760. allowedAttrs: [
  761. 'aria-orientation',
  762. 'aria-activedescendant',
  763. 'aria-expanded'
  764. ],
  765. superclassRole: ['group'],
  766. accessibleNameRequired: true
  767. },
  768. tooltip: {
  769. type: 'structure',
  770. allowedAttrs: ['aria-expanded'],
  771. superclassRole: ['section'],
  772. nameFromContent: true
  773. },
  774. tree: {
  775. type: 'composite',
  776. requiredOwned: ['group', 'treeitem'],
  777. allowedAttrs: [
  778. 'aria-multiselectable',
  779. 'aria-required',
  780. 'aria-activedescendant',
  781. 'aria-expanded',
  782. 'aria-orientation'
  783. ],
  784. superclassRole: ['select'],
  785. // Note: spec difference
  786. accessibleNameRequired: false
  787. },
  788. treegrid: {
  789. type: 'composite',
  790. requiredOwned: ['rowgroup', 'row'],
  791. allowedAttrs: [
  792. 'aria-activedescendant',
  793. 'aria-colcount',
  794. 'aria-expanded',
  795. 'aria-level',
  796. 'aria-multiselectable',
  797. 'aria-orientation',
  798. 'aria-readonly',
  799. 'aria-required',
  800. 'aria-rowcount'
  801. ],
  802. superclassRole: ['grid', 'tree'],
  803. // Note: spec difference
  804. accessibleNameRequired: false
  805. },
  806. treeitem: {
  807. type: 'widget',
  808. requiredContext: ['group', 'tree'],
  809. allowedAttrs: [
  810. 'aria-checked',
  811. 'aria-expanded',
  812. 'aria-level',
  813. 'aria-posinset',
  814. 'aria-selected',
  815. 'aria-setsize'
  816. ],
  817. superclassRole: ['listitem', 'option'],
  818. accessibleNameRequired: true,
  819. nameFromContent: true
  820. },
  821. widget: {
  822. type: 'abstract',
  823. superclassRole: ['roletype']
  824. },
  825. window: {
  826. type: 'abstract',
  827. superclassRole: ['roletype']
  828. }
  829. };
  830. export default ariaRoles;