{"id":13624451,"url":"https://github.com/A11yance/aria-query","last_synced_at":"2025-04-16T00:32:22.488Z","repository":{"id":38814497,"uuid":"79065400","full_name":"A11yance/aria-query","owner":"A11yance","description":"Programmatic access to the ARIA specification","archived":false,"fork":false,"pushed_at":"2024-12-06T16:37:20.000Z","size":2290,"stargazers_count":293,"open_issues_count":11,"forks_count":44,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-11T00:59:06.261Z","etag":null,"topics":["accessibility","aria","wcag2"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/A11yance.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ljharb"],"patreon":null,"open_collective":null,"ko_fi":"ljharb","tidelift":"npm/aria-query","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":"ljharb","custom":null}},"created_at":"2017-01-15T23:03:41.000Z","updated_at":"2025-04-10T09:11:28.000Z","dependencies_parsed_at":"2024-06-18T12:20:09.581Z","dependency_job_id":"46145c17-6dff-41ff-a6a2-a1e2da2aab74","html_url":"https://github.com/A11yance/aria-query","commit_stats":{"total_commits":331,"total_committers":22,"mean_commits":"15.045454545454545","dds":0.552870090634441,"last_synced_commit":"c151dafa6ab17143479e5aeaa0826a3d657cc5be"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A11yance%2Faria-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A11yance%2Faria-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A11yance%2Faria-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A11yance%2Faria-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/A11yance","download_url":"https://codeload.github.com/A11yance/aria-query/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322611,"owners_count":21084336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessibility","aria","wcag2"],"created_at":"2024-08-01T21:01:42.751Z","updated_at":"2025-04-16T00:32:22.113Z","avatar_url":"https://github.com/A11yance.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ljharb","https://ko-fi.com/ljharb","https://tidelift.com/funding/github/npm/aria-query","https://thanks.dev/ljharb"],"categories":["JavaScript","Development Tools Mcp Servers","Cognitive Accessibility"],"sub_categories":[],"readme":"# ARIA Query\n\n![CI](https://github.com/A11yance/aria-query/workflows/CI/badge.svg)\n\nProgrammatic access to the [WAI-ARIA 1.2 Roles Model](https://www.w3.org/TR/wai-aria-1.2/#roles).\nThis package tracks the W3C Recommendation (last update: 6 June 2023).\n\nCDN URL: \u003chttps://unpkg.com/aria-query\u003e\n\n## Building the `src/etc` files\n\nThe files under `src/etc` are generated by the `breakUpAriaJSON` script.\n\nTo change them, edit the file `scripts/roles.json` then run:\n\n```bash\nnode ./scripts/breakUpAriaJSON.js\ngit add scripts/roles.json src/etc\n```\n\nIt should work with Node version 6.11.2 or later.\n\n## Utilities\n\n### Interface\n\nThese methods are available on each export from the module. The typing here in the documentation is pseudo-typed. Each export will have its own specific types for each method signature.\n\n```javascript\n{|\n  entries: () =\u003e Array\u003c$Item\u003e,\n  get: (key: $Key) =\u003e ?$Value,\n  has: (key: $Key) =\u003e boolean,\n  keys: () =\u003e Array\u003c$Key\u003e,\n  values: () =\u003e Array\u003c$Value\u003e,\n|};\n```\n\n### Roles\n\n```javascript\nimport { roles } from 'aria-query';\n```\n\nA map of role names to the role definition. For example:\n\n```javascript\nlet alertRole = roles.get('alert');\n/**\n * Value of alertRole\n * {\n *   \"requiredProps\": {},\n *   \"props\": {\n *     \"aria-atomic\": \"true\",\n *     \"aria-busy\": null,\n *     \"aria-controls\": null,\n *     \"aria-current\": null,\n *     \"aria-describedby\": null,\n *     \"aria-details\": null,\n *     \"aria-disabled\": null,\n *     \"aria-dropeffect\": null,\n *     \"aria-errormessage\": null,\n *     \"aria-expanded\": null,\n *     \"aria-flowto\": null,\n *     \"aria-grabbed\": null,\n *     \"aria-haspopup\": null,\n *     \"aria-hidden\": null,\n *     \"aria-invalid\": null,\n *     \"aria-keyshortcuts\": null,\n *     \"aria-label\": null,\n *     \"aria-labelledby\": null,\n *     \"aria-live\": \"assertive\",\n *     \"aria-owns\": null,\n *     \"aria-relevant\": null,\n *     \"aria-roledescription\": null\n *   },\n *   \"abstract\": false,\n *   \"childrenPresentational\": false,\n *   \"baseConcepts\": [],\n *   \"relatedConcepts\": [ {\n *     \"module\": \"XForms\",\n *     \"concept\": {\n *       \"name\": \"alert\"\n *     }\n *   }],\n *   \"superClass\": [[\"roletype\", \"structure\", \"section\"]]\n * }\n```\n\n### Elements to Roles\n\n```javascript\nimport { elementRoles } from 'aria-query';\n```\n\nHTML Elements with inherent roles are mapped to those roles. In the case of an element like `\u003cinput\u003e`, the element often requires a `type` attribute to map to an ARIA role.\n\n```javascript\n[\n  [ '{\"name\": \"article\"}', [ 'article' ] ],\n  [ '{\"name\": \"button\"}', [ 'button' ] ],\n  [ '{\"name\": \"td\"}', [ 'cell', 'gridcell' ] ],\n  [ '{\"name\": \"input\", \"attributes\": [ {\"name\": \"type\", \"value\": \"checkbox\"}] }', [ 'checkbox' ] ],\n  [ '{\"name\": \"th\"}', [ 'columnheader' ] ],\n  [ '{\"name\": \"select\"}', [ 'combobox', 'listbox' ] ],\n  [ '{\"name\": \"menuitem\"}', [ 'command', 'menuitem' ] ],\n  [ '{\"name\": \"dd\"}', [ 'definition' ] ],\n  [ '{\"name\": \"figure\"}', [ 'figure' ] ],\n  [ '{\"name\": \"form\"}', [ 'form' ] ],\n  [ '{\"name\": \"table\"}', [ 'grid', 'table' ] ],\n  [ '{\"name\": \"fieldset\"}', [ 'group' ] ],\n  [ '{\"name\": \"h1\"}', [ 'heading' ] ],\n  [ '{\"name\": \"h2\"}', [ 'heading' ] ],\n  [ '{\"name\": \"h3\"}', [ 'heading' ] ],\n  [ '{\"name\": \"h4\"}', [ 'heading' ] ],\n  [ '{\"name\": \"h5\"}', [ 'heading' ] ],\n  [ '{\"name\": \"h6\"}', [ 'heading' ] ],\n  [ '{\"name\": \"img\"}', [ 'img' ] ],\n  [ '{\"name\": \"a\"}', [ 'link' ] ],\n  [ '{\"name\": \"link\"}', [ 'link' ] ],\n  [ '{\"name\": \"ol\"}', [ 'list' ] ],\n  [ '{\"name\": \"ul\"}', [ 'list' ] ],\n  [ '{\"name\": \"li\"}', [ 'listitem' ] ],\n  [ '{\"name\": \"nav\"}', [ 'navigation' ] ],\n  [ '{\"name\": \"option\"}', [ 'option' ] ],\n  [ '{\"name\": \"input\", \"attributes\": [ {\"name\": \"type\", \"value\": \"radio\"}] }', [ 'radio' ] ],\n  [ '{\"name\": \"frame\"}', [ 'region' ] ],\n  [ '{\"name\": \"rel\"}', [ 'roletype' ] ],\n  [ '{\"name\": \"tr\"}', [ 'row' ] ],\n  [ '{\"name\": \"tbody\"}', [ 'rowgroup' ] ],\n  [ '{\"name\": \"tfoot\"}', [ 'rowgroup' ] ],\n  [ '{\"name\": \"thead\"}', [ 'rowgroup' ] ],\n  [ '{\"name\": \"th\", \"attributes\": [ {\"name\": \"scope\", \"value\": \"row\"}] }', [ 'rowheader' ] ],\n  [ '{\"name\": \"input\", \"attributes\": [ {\"name\": \"type\", \"value\": \"search\"}] }', [ 'searchbox' ] ],\n  [ '{\"name\": \"hr\"}', [ 'separator' ] ],\n  [ '{\"name\": \"dt\"}', [ 'term' ] ],\n  [ '{\"name\": \"dfn\"}', [ 'term' ] ],\n  [ '{\"name\": \"textarea\"}', [ 'textbox' ] ],\n  [ '{\"name\": \"input\", \"attributes\": [ {\"name\": \"type\", \"value\": \"text\"}] }', [ 'textbox' ] ],\n]\n```\n\nThe map of elements to roles is keyed by an HTML concept. An HTML concept corresponds to the `baseConcepts` and `relatedConcepts` of an ARIA role. Concepts exist in the context of a `module`: HTML, XForms, Dublin Core, for example.  The concept representation is an object literal with a name property (the element name) and an optional attributes array.\n\nThe roles are provided in a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set).\n\n### Role to element\n\n```javascript\nimport { roleElements } from 'aria-query';\n```\n\nARIA roles are mapped to the HTML Elements with the same inherent role. Some roles, such as `columnheader` are only mapped to an HTML element that expresses specific attributes. In the case of `\u003cinput\u003e`, the element often requires a `type` attribute to map to an ARIA role.\n\n```javascript\n[\n  [ 'article', [ {\"name\": \"article\"} ] ],\n  [ 'button', [ {\"name\": \"button\"} ] ],\n  [ 'cell', [ {\"name\": \"td\"} ] ],\n  [ 'checkbox', [ {\"name\": \"input\", \"attributes\": [ {\"name\": \"type\", \"value\": \"checkbox\"}] } ] ],\n  [ 'columnheader', [ {\"name\": \"th\"} ] ],\n  [ 'combobox', [ {\"name\": \"select\"} ] ],\n  [ 'command', [ {\"name\": \"menuitem\"} ] ],\n  [ 'definition', [ {\"name\": \"dd\"}', '{\"name\": \"dfn\"} ] ],\n  [ 'figure', [ {\"name\": \"figure\"} ] ],\n  [ 'form', [ {\"name\": \"form\"} ] ],\n  [ 'grid', [ {\"name\": \"table\"} ] ],\n  [ 'gridcell', [ {\"name\": \"td\"} ] ],\n  [ 'group', [ {\"name\": \"fieldset\"} ] ],\n  [ 'heading', [ {\"name\": \"h1\"}', '{\"name\": \"h2\"}', '{\"name\": \"h3\"}', '{\"name\": \"h4\"}',  '{\"name\": \"h5\"}', '{\"name\": \"h6\"} ] ],\n  [ 'img', [ {\"name\": \"img\"} ] ],\n  [ 'link', [ {\"name\": \"a\"}', '{\"name\": \"link\"} ] ],\n  [ 'list', [ {\"name\": \"ol\"}', '{\"name\": \"ul\"} ] ],\n  [ 'listbox', [ {\"name\": \"select\"} ] ],\n  [ 'listitem', [ {\"name\": \"li\"} ] ],\n  [ 'menuitem', [ {\"name\": \"menuitem\"} ] ],\n  [ 'navigation', [ {\"name\": \"nav\"} ] ],\n  [ 'option', [ {\"name\": \"option\"} ] ],\n  [ 'radio', [ {\"name\": \"input\", \"attributes\": [ {\"name\": \"type\", \"value\": \"radio\"}] } ] ],\n  [ 'region', [ {\"name\": \"frame\"} ] ],\n  [ 'roletype', [ {\"name\": \"rel\"} ] ],\n  [ 'row', [ {\"name\": \"tr\"} ] ],\n  [ 'rowgroup', [ {\"name\": \"tbody\"}', '{\"name\": \"tfoot\"}', '{\"name\": \"thead\"} ] ],\n  [ 'rowheader', [ {\"name\": \"th\", \"attributes\": [ {\"name\": \"scope\", \"value\": \"row\"}] }, {\"name\": \"th\", \"attributes\": [ {\"name\": \"scope\", \"value\": \"rowgroup\"}] } ] ],\n  [ 'searchbox', [ {\"name\": \"input\", \"attributes\": [ {\"name\": \"type\", \"value\": \"search\"}] } ] ],\n  [ 'separator', [ {\"name\": \"hr\"} ] ],\n  [ 'table', [ {\"name\": \"table\"} ] ],\n  [ 'term', [ {\"name\": \"dt\"} ] ],\n  [ 'textbox', [ {\"name\": \"textarea\"}', '{\"name\": \"input\", \"attributes\": [ {\"name\": \"type\", \"value\": \"text\"}] } ] ],\n]\n```\n\n## License\n\nCopyright (c) 2021 A11yance\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FA11yance%2Faria-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FA11yance%2Faria-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FA11yance%2Faria-query/lists"}