Skip to main content
Glama

a11y-toolkit: Keyboard-trap detector

a11y_keyboard
Read-onlyIdempotent

Detect keyboard traps in web pages by simulating real Tab presses and testing whether Escape releases the focus cycle. Returns the tab stop list for WCAG 2.1.2 compliance.

Instructions

Keyboard-trap detection (2.1.2) with REAL Tab walking in Chromium: up to 60 real tab stops, cycle detection (the modal pattern), then the decisive test — does ESCAPE release the cycle? A modal that cycles and releases on Escape is correct and NOT reported; a cycle Escape cannot leave is a trap (high severity). Returns the full tab stop list too. Requires local Playwright. — Scope: keyboard traps (2.1.2); focus visibility is part of a11y_audit_dom.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesPage URL to Tab-walk (http/https or file://)
langNoOutput language (default en)
max_pasosNomax real Tab presses (60 default)
auth_stateNoPath to a Playwright storage_state JSON (exported session) to Tab-walk behind login

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv4.0.0
    • addedInput schema / browser
      Added value: +{
      +  "description": "Browser engine (auto = detect the first available)",
      +  "enum": [
      +    "auto",
      +    "chromium",
      +    "firefox",
      +    "webkit",
      +    "chrome",
      +    "msedge"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / auth_state
      Added value: +{
      +  "description": "Path to a Playwright storage_state JSON (exported session) to Tab-walk behind login",
      +  "type": "string"
      +}
    • addedInput schema / properties / lang / description
      Added value: +"Output language (default en)"
    • addedInput schema / properties / url / description
      Added value: +"Page URL to Tab-walk (http/https or file://)"
  2. Addedv3.3.0

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description goes well beyond the annotations (readOnlyHint, openWorldHint, idempotentHint) by detailing the actual algorithm: real Tab walking up to 60 stops, cycle detection, the Escape-release test, and the specific decision rule for reporting a trap as high severity. This is valuable behavioral insight not available from structured fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense and front-loaded with the core purpose. Every sentence serves a role: algorithm, cycle/escape logic, return value, environment requirement, and scope separation. No filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description still explains the return value (full tab stop list) and the severity logic. It also covers the Playwright prerequisite and scope. It doesn't detail the exact output structure or error behavior, but the essential information for calling is present.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema covers all 4 parameters with descriptions (100% coverage), so the description doesn't need to compensate. It adds some context (e.g., 'up to 60 real tab stops' aligns with max_pasos) but does not materially change parameter meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action ('detection') on a specific resource ('keyboard traps') with the WCAG reference '2.1.2'. It explicitly distinguishes from sibling a11y_audit_dom by noting focus visibility is part of that tool, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit scope ('keyboard traps (2.1.2)') and identifies the sibling that covers the adjacent concern ('focus visibility is part of a11y_audit_dom'). It also notes a concrete prerequisite ('Requires local Playwright'), helping agents decide when this tool can be used.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.