bug: ion-menu focuses its full-screen host on open and does not restore focus to ion-menu-button on close; ion-menu-button reads aria-label only once

オープン
#31,620 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript

調査の方向性

The issue identifies ion-menu focus handling and ion-menu-button label updates, but names no Ionic source files or tests. Start by locating those components and their existing accessibility tests, then reproduce the reported open, close, and runtime label changes. Done when focus moves to the visible menu on open, returns to the opener on close, and updated labels are reflected.

索引モデルが issue の本文から書いたものです。

説明

type: bug
Prerequisites
Ionic Framework Version

v8.x

Current Behavior
  1. When an ion-menu is closed with the keyboard (Escape or a close button inside the menu),
    the menu blurs the focused element and does not return focus to the ion-menu-button that
    opened it. The focus lands on <body>; a keyboard or screen reader user has to start over
    from the top of the page. Measured on Android 14 (Chromium WebView) and iOS 26 (WKWebView).
  2. ion-menu-button reads its aria-label once (inheritAttributes on load). When the app
    changes the label at runtime (language switch), the button keeps the old name until the
    next page is rendered, while ion-menu itself picks up a new aria-label immediately.
  3. Without an app-provided label the button and the menu are announced with the English
    defaults ("menu", "Navigation. In menu") regardless of the document language.
  4. When the menu opens, ion-menu moves focus to its own host element (afterAnimation calls
    this.el.focus() with tabindex="0" set in beforeAnimation). The host has
    role="navigation" and covers the whole viewport (left/right/top/bottom: 0, backdrop
    included), so TalkBack draws its focus frame around the entire screen instead of the visible
    menu panel and announces only the landmark name. Measured on Android 14 (Chromium WebView,
    TalkBack): after opening, document.activeElement is the ion-menu host.

Verified with the reproduction on Ionic 8.8.5 (Chrome 154, page "2 ion-menu focus"): after closing the menu
document.activeElement is <body>; after changing the host aria-label to "Open menu" the inner button still
carries "Menü öffnen".

Expected Behavior
  • Closing the menu restores focus to the element that opened it, as ion-modal,
    ion-popover and ion-alert do.
  • aria-label changes on ion-menu-button are reflected.
  • Opening the menu focuses the visible menu panel (.menu-inner) or its first focusable
    element, so the screen reader focus matches what is visible.
Steps to Reproduce
  • Closing the menu restores focus to the element that opened it, as ion-modal,
    ion-popover and ion-alert do.
  • aria-label changes on ion-menu-button are reflected.
  • Opening the menu focuses the visible menu panel (.menu-inner) or its first focusable
    element, so the screen reader focus matches what is visible.
Code Reproduction URL

https://stackblitz.com/github/mrambow/starterApp/tree/a11y-repros (page /repro/menu)
GitHub: https://github.com/mrambow/starterApp/tree/a11y-repros (src/app/repros/menu.page.ts)

Code Reproduction URL

https://github.com/mrambow/starterApp/tree/a11y-repros

Ionic Info

Ionic 8.8.5, Angular 17.3, Capacitor 6 (reproduction); found in Ionic 8.8.5, Angular 21, Capacitor 8

Additional Information

No response

主要言語
TypeScript
スター
52.7k
フォーク
13.3k
平均マージ
2日 21時間
マージ済み PR(30日)
65

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ionic-team/ionic-framework のほかの issue

ionic-team/ionic-framework の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。