Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: AppLayout mobile navigation renders unsupported aria-orientation on nav

Aperta Adatta ai principianti
#5,152 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
playwright, react, typescript

Direzione di ricerca

Inizia da src/app-layout/visual-refresh/mobile-toolbar.tsx, righe 56–59, dove l’issue identifica l’attributo non supportato nella navigazione mobile. Controlla i test AppLayout esistenti per la navigazione mobile e aggiungi test per lo stato chiuso. Il lavoro è completato quando il controllo rigoroso dell’accessibilità passa senza rimuovere il nome accessibile, la semantica di navigazione o il comportamento di attivazione e di focus.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Browser

Chrome / Chromium 149.0.7827.55 (Playwright).

Package version

3.0.1401 and 3.0.1310.

React version

19.2.7.

Description

When the standard AppLayout is rendered at a mobile viewport with navigation closed, its SDK-owned mobile navigation nav receives aria-orientation="horizontal". The element retains the implicit navigation role, which does not support this attribute. Strict axe scans report aria-allowed-attr.

Reproduced on both @cloudscape-design/components 3.0.1310 and 3.0.1401. Version 3.0.1401 was the npm latest version checked on 2026-10-16. The standalone reproduction uses no application wrappers or product theme, and does not alter Cloudscape DOM or CSS.

Actual behavior

The visible closed-state mobile toolbar renders the following markup (generated class names omitted):

<nav aria-hidden="false" aria-label="Navigation" aria-orientation="horizontal">
  <!-- SDK navigation toggle -->
</nav>

axe-core 4.12.1 reports aria-allowed-attr, with impact classified as critical and the message ARIA attribute is not allowed: aria-orientation="horizontal".

Expected behavior

The navigation landmark uses supported ARIA attributes. Please correct the SDK-owned markup while retaining its accessible name, navigation semantics, and toggle/focus behavior. If orientation belongs to a toolbar widget, it should be applied to a semantically appropriate element.

Verified matrix
Scenario SDK 3.0.1310 SDK 3.0.1401
AppLayout, 390×844, navigation closed aria-allowed-attr (one node) aria-allowed-attr (one node)
AppLayout, 390×844, navigation open No WCAG violations No WCAG violations
AppLayout, 1280×900, navigation closed No WCAG violations No WCAG violations
AppLayoutToolbar, 390×844, navigation closed No WCAG violations No WCAG violations

The affected component is standard AppLayout; AppLayoutToolbar is included only as a diagnostic control. This report does not concern the legacy Classic visual theme.

Environment and impact
  • Chromium 149.0.7827.55 via Playwright 1.61.1; Windows; Node.js v24.19.0.
  • React/React DOM 19.2.7; Cloudscape global styles 1.0.60; axe-core 4.12.1.
  • Strict scans use WCAG 2 A, WCAG 2 AA, and WCAG 2.1 AA tags, with no disabled rules or node exclusions.
  • The invalid attribute causes automated accessibility gates to fail for standard mobile AppLayout consumers. Screen-reader behavior has not been assessed in this reproduction.
Source and references
Acceptance check

The strict reproduction below should exit 0 after a fix, with all four scenarios passing and without suppressing aria-allowed-attr. Mobile navigation should still open and close with the same accessible controls.

Source code

The minimal failing component is:

import React from "react";
import { createRoot } from "react-dom/client";
import AppLayout from "@cloudscape-design/components/app-layout";
import "@cloudscape-design/global-styles/index.css";

createRoot(document.getElementById("root")).render(
  <AppLayout
    navigation={<a href="#content">Example section</a>}
    navigationOpen={false}
    toolsHide
    ariaLabels={{
      navigation: "Navigation",
      navigationToggle: "Open navigation",
      navigationClose: "Close navigation",
    }}
    content={<h1 id="content">Minimal AppLayout reproduction</h1>}
  />
);

The standalone project adds controlled navigation state and the Toolbar control so all matrix cases can run from the same fixture. The full standalone source and direct dependency pins are included below.

Reproduction

  1. Save the four source files below in a new standalone directory, install the pinned direct dependencies and Playwright Chromium, then build it.
  2. Run pnpm test. It starts and stops its own local server, scans four scenarios, and writes evidence/report.json plus PNGs.
  3. With affected versions, the expected exit code is 1: only app-layout-mobile-closed fails aria-allowed-attr.
  4. For manual inspection, run pnpm dev, open http://127.0.0.1:5295/, set the viewport to 390×844, and keep navigation closed.
  5. Inspect the mobile navigation toggle parent nav and run axe. Open navigation or use the desktop viewport to compare. ?layout=toolbar is the control.
corepack pnpm install --ignore-workspace
corepack pnpm exec playwright install chromium
corepack pnpm build
corepack pnpm test

The default standalone project pins SDK 3.0.1401. To rerun the baseline, change only the SDK version to 3.0.1310, regenerate the lockfile, and rerun. Both captured JSON reports are included below. The script generates fresh screenshots and a report locally.

Standalone reproduction files

Use Node.js 24 and pnpm 9.15.0. All direct dependencies are pinned; pnpm install generates the lockfile. No workspace packages are required.

package.json
{
  "name": "cloudscape-app-layout-mobile-aria-repro",
  "version": "1.0.0",
  "private": true,
  "type": "module",
  "packageManager": "[email protected]",
  "scripts": {
    "dev": "vite --host 127.0.0.1 --port 5295",
    "build": "vite build",
    "test": "node capture.mjs"
  },
  "dependencies": {
    "@cloudscape-design/components": "3.0.1401",
    "@cloudscape-design/global-styles": "1.0.60",
    "react": "19.2.7",
    "react-dom": "19.2.7"
  },
  "devDependencies": {
    "axe-core": "4.12.1",
    "playwright": "1.61.1",
    "vite": "6.4.3"
  }
}
index.html
<!doctype html>
<html lang="en">
  <head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>AppLayout mobile ARIA reproduction</title></head>
  <body style="margin:0"><div id="root"></div><script type="module" src="/main.jsx"></script></body>
</html>
main.jsx
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import AppLayout from "@cloudscape-design/components/app-layout";
import AppLayoutToolbar from "@cloudscape-design/components/app-layout-toolbar";
import "@cloudscape-design/global-styles/index.css";

function Reproduction() {
  const [navigationOpen, setNavigationOpen] = useState(false);
  const Layout = new URLSearchParams(location.search).get("layout") === "toolbar"
    ? AppLayoutToolbar
    : AppLayout;

  return (
    <Layout
      navigation={<a href="#content">Example section</a>}
      navigationOpen={navigationOpen}
      onNavigationChange={({ detail }) => setNavigationOpen(detail.open)}
      toolsHide
      ariaLabels={{
        navigation: "Navigation",
        navigationToggle: "Open navigation",
        navigationClose: "Close navigation",
      }}
      content={<h1 id="content">Minimal AppLayout reproduction</h1>}
    />
  );
}

createRoot(document.getElementById("root")).render(<Reproduction />);
capture.mjs
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { createServer } from "vite";
import { chromium } from "playwright";
import axe from "axe-core";

const root = path.dirname(fileURLToPath(import.meta.url));
const output = path.join(root, "evidence");
const pkg = JSON.parse(await fs.readFile(path.join(root, "package.json"), "utf8"));
await fs.mkdir(output, { recursive: true });
const server = await createServer({ root, configFile: false, server: { host: "127.0.0.1", port: 0 } });
await server.listen();
const address = server.httpServer.address();
const baseUrl = `http://127.0.0.1:${address.port}/`;
const browser = await chromium.launch({
  headless: true,
  ...(process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH
    ? { executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH }
    : {}),
});
const report = {
  checkedAt: new Date().toISOString(),
  environment: { node: process.version, platform: process.platform, browser: browser.version(), ...pkg.dependencies, axe: pkg.devDependencies["axe-core"] },
  cases: [],
};

async function scan(page, name) {
  await page.addScriptTag({ content: axe.source });
  const result = await page.evaluate(() => axe.run(document, {
    runOnly: { type: "tag", values: ["wcag2a", "wcag2aa", "wcag21aa"] },
  }));
  const violations = result.violations.map(({ id, impact, help, nodes }) => ({
    id, impact, help, nodes: nodes.map(({ html, target, failureSummary }) => ({ html, target, failureSummary })),
  }));
  await page.screenshot({ path: path.join(output, name + ".png"), fullPage: true });
  report.cases.push({ name, viewport: page.viewportSize(), violations });
  console.log(`${violations.length ? "FAIL" : "PASS"} ${name}: ${violations.map(v => v.id).join(", ") || "no WCAG violations"}`);
}

try {
  for (const [width, height] of [[390, 844], [1280, 900]]) {
    const page = await browser.newPage({ viewport: { width, height } });
    const errors = [];
    page.on("pageerror", error => errors.push(error.message));
    await page.goto(baseUrl, { waitUntil: "networkidle" });
    await page.getByRole("heading", { name: "Minimal AppLayout reproduction" }).waitFor();
    await scan(page, width === 390 ? "app-layout-mobile-closed" : "app-layout-desktop-closed");
    if (width === 390) {
      await page.getByRole("button", { name: "Open navigation", exact: true }).click();
      await page.getByRole("link", { name: "Example section" }).waitFor();
      // Let the drawer's opacity transition finish before testing contrast.
      await page.waitForTimeout(500);
      await scan(page, "app-layout-mobile-open");
    }
    if (errors.length) throw new Error(errors.join("; "));
    await page.close();
  }
  const page = await browser.newPage({ viewport: { width: 390, height: 844 } });
  await page.goto(baseUrl + "?layout=toolbar", { waitUntil: "networkidle" });
  await page.getByRole("heading", { name: "Minimal AppLayout reproduction" }).waitFor();
  await scan(page, "app-layout-toolbar-mobile-closed");
  await page.close();
} finally {
  await browser.close();
  await server.close();
}
await fs.writeFile(path.join(output, "report.json"), JSON.stringify(report, null, 2) + "\n");
// This is a strict regression check: exit 1 is expected while the bug exists.
if (report.cases.some(test => test.violations.length > 0)) process.exitCode = 1;

Captured strict scan results

Both builds succeeded. In both runs, pnpm test exited 1 because the mobile closed-state case reports one aria-allowed-attr violation; the three control cases pass. The 500 ms wait in the open-state case lets the navigation opacity transition complete before checking color contrast.

SDK 3.0.1310 — report.json
{
  "checkedAt": "2026-10-16T11:02:01.470Z",
  "environment": {
    "node": "v24.19.0",
    "platform": "win32",
    "browser": "149.0.7827.55",
    "@cloudscape-design/components": "3.0.1310",
    "@cloudscape-design/global-styles": "1.0.60",
    "react": "19.2.7",
    "react-dom": "19.2.7",
    "axe": "4.12.1"
  },
  "cases": [
    {
      "name": "app-layout-mobile-closed",
      "viewport": {
        "width": 390,
        "height": 844
      },
      "violations": [
        {
          "id": "aria-allowed-attr",
          "impact": "critical",
          "help": "Elements must only use supported ARIA attributes",
          "nodes": [
            {
              "html": "<nav aria-hidden=\"false\" aria-label=\"Navigation\" aria-orientation=\"horizontal\" class=\"awsui_mobile-toolbar-nav_hyvsj_ffxhy_675 awsui_drawer-closed_1fj9k_q6akd_15\">",
              "target": [
                ".awsui_mobile-toolbar-nav_hyvsj_ffxhy_675"
              ],
              "failureSummary": "Fix all of the following:\n  ARIA attribute is not allowed: aria-orientation=\"horizontal\""
            }
          ]
        }
      ]
    },
    {
      "name": "app-layout-mobile-open",
      "viewport": {
        "width": 390,
        "height": 844
      },
      "violations": []
    },
    {
      "name": "app-layout-desktop-closed",
      "viewport": {
        "width": 1280,
        "height": 900
      },
      "violations": []
    },
    {
      "name": "app-layout-toolbar-mobile-closed",
      "viewport": {
        "width": 390,
        "height": 844
      },
      "violations": []
    }
  ]
}
SDK 3.0.1401 — report.json
{
  "checkedAt": "2026-10-16T11:02:00.110Z",
  "environment": {
    "node": "v24.19.0",
    "platform": "win32",
    "browser": "149.0.7827.55",
    "@cloudscape-design/components": "3.0.1401",
    "@cloudscape-design/global-styles": "1.0.60",
    "react": "19.2.7",
    "react-dom": "19.2.7",
    "axe": "4.12.1"
  },
  "cases": [
    {
      "name": "app-layout-mobile-closed",
      "viewport": {
        "width": 390,
        "height": 844
      },
      "violations": [
        {
          "id": "aria-allowed-attr",
          "impact": "critical",
          "help": "Elements must only use supported ARIA attributes",
          "nodes": [
            {
              "html": "<nav aria-hidden=\"false\" aria-label=\"Navigation\" aria-orientation=\"horizontal\" class=\"awsui_mobile-toolbar-nav_hyvsj_16epy_499 awsui_drawer-closed_1fj9k_q6akd_15\">",
              "target": [
                ".awsui_mobile-toolbar-nav_hyvsj_16epy_499"
              ],
              "failureSummary": "Fix all of the following:\n  ARIA attribute is not allowed: aria-orientation=\"horizontal\""
            }
          ]
        }
      ]
    },
    {
      "name": "app-layout-mobile-open",
      "viewport": {
        "width": 390,
        "height": 844
      },
      "violations": []
    },
    {
      "name": "app-layout-desktop-closed",
      "viewport": {
        "width": 1280,
        "height": 900
      },
      "violations": []
    },
    {
      "name": "app-layout-toolbar-mobile-closed",
      "viewport": {
        "width": 390,
        "height": 844
      },
      "violations": []
    }
  ]
}

Duplicate search

On 2026-10-16, issue-only searches in this repository for "aria-orientation" and "aria-allowed-attr" returned no matching issues. This does not establish that no related issue exists under another description.

Lingua principale
TypeScript
Stelle
2.7k
Fork
248
Merge medio
3g 14h
PR unite (30g)
83

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di cloudscape-design/components

Tutte le issue di cloudscape-design/components

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.