politico/vue-accessible-selects

Improve documentation, naming, and/or error messages around 'label' and 'isLabelVisible' prop

開放

#66 建立於 2021年1月8日

 (2 則留言) (0 個反應) (0 位負責人)Vue (5 個分叉)auto 404
documentationenhancementgood first issue

倉庫指標

星標
 (12 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

In using this component, we've discovered that it's not super clear how label is expected to be used as a prop: it's marked as required and throws errors if not provided, but sometimes a consuming app won't want to display a text label above the select.

The reason we have it required is because, regardless of whether the label is displayed, some value should be provided to tell screen readers what the select is. So, if the label isn't needed visually, devs should set :isLabelVisible="false"

So, we need to document this better. My current idea is to add validation to the label property - rather than marking it as required, add a validation hook where, if it's not passed in, we can console.warn that the component won't be accessible to screen readers when a label is not provided. If you'd like it to not display visually, simply set isLabelVisible

There are probably other approaches we could take as well

貢獻者指南