bug: ion-modal - aria-labelledby on the host does not reach the dialog element

Offen
#31,622 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
65/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript

Rechercherichtung

Start with ion-modal and its inheritAriaAttributes / htmlAttributes handling, then inspect the dialog element in the shadow root and related accessibility tests. Reproduce with the linked modal example by setting aria-labelledby on the host and inspecting the presented dialog. Done means the dialog receives the label reference and the accessibility tree announces its title.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

type: bug
Prerequisites
Ionic Framework Version

v8.x

Current Behavior

The documentation states that aria-labelledby can be set on ion-modal to name the dialog.
The role="dialog" element lives in the shadow root and only aria-label and role are
forwarded to it (inheritAriaAttributes / htmlAttributes); aria-labelledby set on the host
or via htmlAttributes stays on the host, which has no role, so the dialog is announced
without a name. Naming works only with a literal aria-label, which duplicates the visible
title and is not kept in sync with it.

Verified with the reproduction on Ionic 8.8.5 (Chrome 154, page "4 ion-modal aria-labelledby"): host
aria-labelledby="modal-title", inner [role=dialog] has neither aria-labelledby nor aria-label.

Expected Behavior

The documentation states that aria-labelledby can be set on ion-modal to name the dialog.
The role="dialog" element lives in the shadow root and only aria-label and role are
forwarded to it (inheritAriaAttributes / htmlAttributes); aria-labelledby set on the host
or via htmlAttributes stays on the host, which has no role, so the dialog is announced
without a name. Naming works only with a literal aria-label, which duplicates the visible
title and is not kept in sync with it.

Verified with the reproduction on Ionic 8.8.5 (Chrome 154, page "4 ion-modal aria-labelledby"): host
aria-labelledby="modal-title", inner [role=dialog] has neither aria-labelledby nor aria-label.

Steps to Reproduce
  1. <ion-modal aria-labelledby="t"><ng-template><h2 id="t">Antrag stellen</h2>...</ng-template></ion-modal>
  2. Present the modal and inspect the accessibility tree: the dialog has no name.
Code Reproduction URL

https://stackblitz.com/github/mrambow/starterApp/tree/a11y-repros (page /repro/modal)
GitHub: https://github.com/mrambow/starterApp/tree/a11y-repros (src/app/repros/modal.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

Vorherrschende Sprache
TypeScript
Sterne
52.7k
Forks
13.3k
Ø Merge
3 T. 4 Std.
Gemergte PRs (30 T.)
72

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ionic-team/ionic-framework

Alle Issues in ionic-team/ionic-framework

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.