From bcbd99b8c15b79b3872d28065e2c57333e667998 Mon Sep 17 00:00:00 2001 From: Serhii Kulykov Date: Thu, 10 Jan 2019 15:46:23 +0200 Subject: [PATCH] fix(checkbox): set focusElement to input to avoid firefox issue (#139) --- src/vaadin-checkbox.html | 3 ++- test/vaadin-checkbox_test.html | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/vaadin-checkbox.html b/src/vaadin-checkbox.html index 3ebba83..090d755 100644 --- a/src/vaadin-checkbox.html +++ b/src/vaadin-checkbox.html @@ -266,8 +266,9 @@ }); } + /** @protected */ get focusElement() { - return this.shadowRoot.querySelector('label'); + return this.shadowRoot.querySelector('input'); } /** diff --git a/test/vaadin-checkbox_test.html b/test/vaadin-checkbox_test.html index 896dbbb..f8fa858 100644 --- a/test/vaadin-checkbox_test.html +++ b/test/vaadin-checkbox_test.html @@ -85,6 +85,10 @@ expect(children[2].outerHTML).to.be.equal('Checkbox'); }); + it('should have input as focusElement', () => { + expect(vaadinCheckbox.focusElement).to.be.eql(nativeCheckbox); + }); + it('can be disabled imperatively', () => { vaadinCheckbox.disabled = true; expect(nativeCheckbox.hasAttribute('disabled')).to.be.eql(true);