[英]How to make screen reader read out a validation error text that appears if the user tries to submit invalid information?
我有一个包含输入的 TextInput 组件和一个仅在出现错误时出现的 HelperText。 我想知道如何才能使屏幕阅读器在元素出现错误文本后读取错误?
<TextInputBase
onFocus={(e) => {
setIsFocused(true);
onFocus?.(e);
}}
onBlur={(e) => {
setIsFocused(false);
onBlur?.(e);
}}
outlineColor={colors.gray200}
activeOutlineColor={colors.primary600}
accessibilityLabel={label}
label={label}
error={!!error}
// Hide the placeholder when the input is focused
placeholder={isFocused ? undefined : label}
theme={{ colors: { text: colors.black, placeholder: colors.gray800 } }}
style={[style, styles.input]}
{...rest}
/>
<HelperText
type="error"
visible={!!error}
>
{error}
</HelperText>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.