Home / File/ a11y.ts — astro Source File

a11y.ts — astro Source File

Architecture documentation for a11y.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

File typescript DevToolbar ToolbarClient 3 imports 7 functions

Entity Profile

Dependency Diagram

graph LR
  7c3b1f35_d834_f912_339d_8627bdd8631a["a11y.ts"]
  c19ed93d_c905_8e8a_abab_010a7ccd1966["../rules/index.js"]
  7c3b1f35_d834_f912_339d_8627bdd8631a --> c19ed93d_c905_8e8a_abab_010a7ccd1966
  ada35e3f_743c_089e_85f3_5c97aba81701["aria-query"]
  7c3b1f35_d834_f912_339d_8627bdd8631a --> ada35e3f_743c_089e_85f3_5c97aba81701
  32a3b15b_82ea_5253_758e_5e2d7f1b3f2a["axobject-query"]
  7c3b1f35_d834_f912_339d_8627bdd8631a --> 32a3b15b_82ea_5253_758e_5e2d7f1b3f2a
  style 7c3b1f35_d834_f912_339d_8627bdd8631a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * https://github.com/sveltejs/svelte/blob/61e5e53eee82e895c1a5b4fd36efb87eafa1fc2d/LICENSE.md
 * @license MIT
 *
 * Copyright (c) 2016-23 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

import type { ARIARoleDefinitionKey } from 'aria-query';
import { aria, roles } from 'aria-query';
// @ts-expect-error package does not provide types
import { AXObjectRoles, elementAXObjects } from 'axobject-query';
import type { AuditRuleWithSelector } from './index.js';

const WHITESPACE_REGEX = /\s+/;

const a11y_required_attributes = {
	a: ['href'],
	area: ['alt', 'aria-label', 'aria-labelledby'],
	// html-has-lang
	html: ['lang'],
	// iframe-has-title
	iframe: ['title'],
	img: ['alt'],
	object: ['title', 'aria-label', 'aria-labelledby'],
};

const MAYBE_INTERACTIVE = new Map([
	['a', 'href'],
	['input', 'type'],
	['audio', 'controls'],
	['img', 'usemap'],
	['object', 'usemap'],
	['video', 'controls'],
]);

const interactiveElements = [
	'button',
	'details',
	'embed',
	'iframe',
	'label',
	'select',
// ... (650 more lines)

Domain

Subdomains

Dependencies

  • ../rules/index.js
  • aria-query
  • axobject-query

Frequently Asked Questions

What does a11y.ts do?
a11y.ts is a source file in the astro codebase, written in typescript. It belongs to the DevToolbar domain, ToolbarClient subdomain.
What functions are defined in a11y.ts?
a11y.ts defines 7 function(s): getAttributeObject, getImplicitRole, getRole, input_implicit_role, isInteractive, is_semantic_role_element, menuitem_implicit_role.
What does a11y.ts depend on?
a11y.ts imports 3 module(s): ../rules/index.js, aria-query, axobject-query.
Where is a11y.ts in the architecture?
a11y.ts is located at packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts (domain: DevToolbar, subdomain: ToolbarClient, directory: packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free