From cebed497943cbac6b879832bfdfaf434116f426b Mon Sep 17 00:00:00 2001 From: Floris List Date: Fri, 15 Nov 2024 16:33:51 +0000 Subject: [PATCH] validate that the error state correctly is applied --- packages/core/src/components/TextArea/TextArea.tsx | 2 +- .../core/src/components/TextArea/__tests__/TextArea.test.tsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/components/TextArea/TextArea.tsx b/packages/core/src/components/TextArea/TextArea.tsx index 2bd0dcae5b..1e9630f383 100644 --- a/packages/core/src/components/TextArea/TextArea.tsx +++ b/packages/core/src/components/TextArea/TextArea.tsx @@ -88,7 +88,7 @@ const TextArea = forwardRef( required={required} rows={numRows} className={cx(styles.textArea, [styles[size]], { [styles.resize]: resize })} - aria-invalid={error} + aria-invalid={isErrorState} aria-describedby={ariaDescribedby} onChange={handleOnChange} /> diff --git a/packages/core/src/components/TextArea/__tests__/TextArea.test.tsx b/packages/core/src/components/TextArea/__tests__/TextArea.test.tsx index ca6a3d7d1c..b504edc31b 100644 --- a/packages/core/src/components/TextArea/__tests__/TextArea.test.tsx +++ b/packages/core/src/components/TextArea/__tests__/TextArea.test.tsx @@ -143,6 +143,7 @@ describe("TextArea", () => { expect(input).toHaveValue("12345678910"); expect(charCount).toHaveTextContent("11/10"); + expect(input).toHaveAttribute("aria-invalid", "true"); }); it("should allow text removal when character limit is exceeded", () => {