You may use other attributes in inputProps as well (e.g. aria-labelledby, title).
One of the categories Lighthouse checks for is Accessibility. When certain elements like your Switch do not have an accessible name, an aria-label may be used to provide the element with an accessible name.
发布评论
评论(1)
添加 到
switch
:您也可以在
inputprops
中使用其他属性(例如)。灯塔检查的类别之一是可访问性。当某些元素(例如
switch
)没有可访问的名称时,可以使用aria-label
来为元素提供可访问的名称。Add an
aria-label
to theSwitch
:You may use other attributes in
inputProps
as well (e.g.aria-labelledby
,title
).One of the categories Lighthouse checks for is Accessibility. When certain elements like your
Switch
do not have an accessible name, anaria-label
may be used to provide the element with an accessible name.