From ee07e8c427f6671efafc6f355149a4c810eeccbd Mon Sep 17 00:00:00 2001 From: Serhii Kulykov Date: Thu, 19 Mar 2020 16:54:49 +0200 Subject: [PATCH] fix: set aria-checked properly when checked is null (#165) Co-authored-by: Phan Hong Duc --- src/vaadin-checkbox.html | 2 +- test/accessibility.html | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vaadin-checkbox.html b/src/vaadin-checkbox.html index 0644d9e..357c2ec 100644 --- a/src/vaadin-checkbox.html +++ b/src/vaadin-checkbox.html @@ -221,7 +221,7 @@ if (this.indeterminate) { this.setAttribute('aria-checked', 'mixed'); } else { - this.setAttribute('aria-checked', checked); + this.setAttribute('aria-checked', Boolean(checked)); } } diff --git a/test/accessibility.html b/test/accessibility.html index fac8140..1535976 100644 --- a/test/accessibility.html +++ b/test/accessibility.html @@ -70,6 +70,10 @@ expect(vaadinCheckbox.getAttribute('aria-checked')).to.be.eql('mixed'); }); + it('should set aria-checked to "false" when checked is set to null', () => { + vaadinCheckbox.checked = null; + expect(vaadinCheckbox.getAttribute('aria-checked')).to.eql('false'); + }); }); });