chore: align aria-invalid check with W3C specs
This commit is contained in:
parent
57407b4e8e
commit
af391f3055
|
|
@ -469,7 +469,9 @@ export function getElementAccessibleErrorMessage(element: Element, includeHidden
|
||||||
accessibleErrorMessage = '';
|
accessibleErrorMessage = '';
|
||||||
|
|
||||||
const ariaInvalid = element.getAttribute('aria-invalid');
|
const ariaInvalid = element.getAttribute('aria-invalid');
|
||||||
if (ariaInvalid === 'true') {
|
// const isAriaInvalid = ariaInvalid === 'true' || (ariaInvalid !== 'false' && ariaInvalid !== null && ariaInvalid !== '');
|
||||||
|
const isAriaInvalid = ariaInvalid !== null && ariaInvalid.toLowerCase() !== 'false';
|
||||||
|
if (isAriaInvalid) {
|
||||||
const errorMessageId = element.getAttribute('aria-errormessage');
|
const errorMessageId = element.getAttribute('aria-errormessage');
|
||||||
if (errorMessageId) {
|
if (errorMessageId) {
|
||||||
// Ensure the ID is valid (no whitespace)
|
// Ensure the ID is valid (no whitespace)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue