charcoal
charcoal copied to clipboard
Feat: `aria-labelledby`相当の機能が`Switch`にほしいです
必要だと思う機能の内容を書いてください
他の構造的に離れた要素でラベルを提供しているUIを表現するためaria-labelledby
かそれと同等の機能がほしいです
この機能が必要と考えられる理由を書いてください
APGによると、switch
ロールはaria-label
や視覚可能なテキストコンテンツの代わりにaria-labelledby
属性を指定することができるとあります。
https://www.w3.org/WAI/ARIA/apg/patterns/switch/
現在の実装だと、labelか、childrenしか受け取りません。 https://github.com/pixiv/charcoal/blob/de4162c889061d424c034459e498a4f7eae18960/packages/react/src/components/Switch/index.tsx#L18
この機能があった場合にどういう動きをするかの例を書いてください
react-ariaのuseSwitchのariaPropsにこれらの値が渡り、いろいろなユーザエージェントがこれを読み取れる状態。
また、他にもaria属性はいくつかサポートされていて、aria-description
/aria-describedby
などの追加テキスト情報を提供できるものや、aria-controls
による操作対象のUIを指定できるものがありそうです。
Switch control should expose aria-labelledby props
According to APG, switch
role may have an aria-labelledby
attr instead of aria-label
.
https://www.w3.org/WAI/ARIA/apg/patterns/switch/
In the current implementation, the Switch
component only exposes aria-label
and children as text content.
https://github.com/pixiv/charcoal/blob/de4162c889061d424c034459e498a4f7eae18960/packages/react/src/components/Switch/index.tsx#L18
(...and, there are more aria props, aria-description
and aria-describedby
, aria-details
attrs to represent additional text content, aria-controls
to represent content controlled by the switch.)