diff --git a/packages/components/src/components/textarea/textarea.test.ts b/packages/components/src/components/textarea/textarea.test.ts index 48f1b0dbc..665559f8b 100644 --- a/packages/components/src/components/textarea/textarea.test.ts +++ b/packages/components/src/components/textarea/textarea.test.ts @@ -185,6 +185,7 @@ describe('', () => { await el.updateComplete; expect(el.checkValidity()).to.be.true; + expect(el.shadowRoot!.querySelector('textarea')!.getAttribute('aria-invalid')).to.equal('false'); expect(el.hasAttribute('data-user-invalid')).to.be.false; expect(el.hasAttribute('data-user-valid')).to.be.true; }); @@ -206,6 +207,7 @@ describe('', () => { el.blur(); await el.updateComplete; + expect(el.shadowRoot!.querySelector('textarea')!.getAttribute('aria-invalid')).to.equal('true'); expect(el.hasAttribute('data-user-invalid')).to.be.true; expect(el.hasAttribute('data-user-valid')).to.be.false; }); diff --git a/packages/components/src/components/textarea/textarea.ts b/packages/components/src/components/textarea/textarea.ts index 379fa2fa6..a2519fbc2 100644 --- a/packages/components/src/components/textarea/textarea.ts +++ b/packages/components/src/components/textarea/textarea.ts @@ -404,7 +404,8 @@ export default class SdTextarea extends SolidElement implements SolidFormControl spellcheck=${ifDefined(this.spellcheck)} enterkeyhint=${ifDefined(this.enterkeyhint)} inputmode=${ifDefined(this.inputmode)} - aria-describedby="help-text" + aria-describedby="help-text invalid-message" + aria-invalid=${this.showInvalidStyle} @change=${this.handleChange} @input=${this.handleInput} @invalid=${this.handleInvalid}