bug: ion-input-otp - inputs are named "Input n of m" only, host ARIA is not forwarded, error text cannot be associated, focus outline removed

未關閉
#31,619 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
typescript

研究方向

Start by locating the ion-input-otp component implementation and its accessibility and focus-style tests; the issue does not name their paths. Read how host ARIA attributes reach the group and how native inputs get their labels, then check the input styling. Done when each input can have an understandable label and associated error state, and keyboard focus has a visible indicator.

由索引模型根據 Issue 內容生成。

描述

type: bug
Prerequisites
Ionic Framework Version

v8.x, v9.x

Current Behavior

ion-input-otp renders its native <input> elements with a fixed, English accessible name
("Input 1 of 6" ... "Input 6 of 6"). An aria-label set on the host is forwarded to the group
only, not to the inputs, so a screen reader user never hears what the inputs are for (e.g. "PIN").
An error message rendered next to the component cannot be associated with the inputs: there is
no way to set aria-describedby / aria-errormessage or aria-invalid on the native inputs.
The component also removes the focus outline (outline: none, specificity 0,4,0), so keyboard
focus is visible only through the border colour, and the default border colour is set in a rule
with specificity 0,2,0 that can only be overridden via --ion-color-step-300, not via
--border-color.

Measured with TalkBack (Android 14, Capacitor 8): "Passwort. 1 Zeichen. Input 5 of 6".
Verified on Ionic 9.0.8 and 8.8.5 with identical results (Chrome headless, accessibility tree, after
tabbing into the component): the host aria-label, aria-describedby and aria-invalid move to the
role="group" wrapper (group: name "PIN", description = error text, invalid=true); the native inputs
keep the name "Input 1 of 6" with no description and invalid=false; the focused input has
outline: none, only the border colour changes. A previous attempt to add helperText/errorText
(#30698) was closed without merge.

Expected Behavior
  • A way to label the inputs (translated, e.g. "PIN, Ziffer 1 von 6"), for example an
    inputLabel function or forwarding aria-label with the index appended.
  • aria-describedby / aria-invalid forwarded to the native inputs so an error message can be
    associated.
  • A visible focus indicator with at least 3:1 contrast, or a --focus-outline CSS variable.
Steps to Reproduce
  1. Place <ion-input-otp length="6" aria-label="PIN"></ion-input-otp> and a <p id="err"> error
    message next to it.
  2. Inspect the accessibility tree: inputs are named "Input 1 of 6" ...; aria-label sits on the group.
  3. Try to associate #err with the inputs - no API.
  4. Tab into the component: no outline, only the border colour changes.
Code Reproduction URL

https://github.com/mrambow/starterApp/blob/a11y-repros/core-repros/otp.html - single HTML file, no build,
loads @ionic/core from jsDelivr; ?v=8.8.5 switches the version.
Live: https://raw.githack.com/mrambow/starterApp/a11y-repros/core-repros/otp.html

Code Reproduction URL

https://github.com/mrambow/starterApp/blob/a11y-repros/core-repros/otp.html

Ionic Info

@ionic/core 9.0.8 and 8.8.5, plain HTML. Found in: Ionic 8.8.5, Angular 21, Capacitor 8;
Android 14 WebView (TalkBack), iOS 26.

Additional Information

No response

主要語言
TypeScript
星號
52.8k
分支
13.3k
平均合併
3 天 1 小時
30 天內合併 PR
86

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ionic-team/ionic-framework 的其他 Issue

查看 ionic-team/ionic-framework 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。