From 2045280063293916eb1bbf014df7017f7fe05bf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kari=20So=CC=88derholm?= Date: Fri, 29 Mar 2019 16:54:49 +0200 Subject: [PATCH] fix: get rid of ControlStateMixin in vaadin-combo-box-light --- src/vaadin-combo-box-light.html | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/vaadin-combo-box-light.html b/src/vaadin-combo-box-light.html index d3efc49dd..e294b1e7c 100644 --- a/src/vaadin-combo-box-light.html +++ b/src/vaadin-combo-box-light.html @@ -5,7 +5,6 @@ --> - @@ -80,18 +79,16 @@ * * ``` * @memberof Vaadin - * @mixes Vaadin.ControlStateMixin * @mixes Vaadin.ComboBoxDataProviderMixin * @mixes Vaadin.ComboBoxMixin * @mixes Vaadin.ThemableMixin * @mixes Vaadin.ThemePropertyMixin */ class ComboBoxLightElement extends - Vaadin.ControlStateMixin( - Vaadin.ThemePropertyMixin( - Vaadin.ThemableMixin( - Vaadin.ComboBoxDataProviderMixin( - Vaadin.ComboBoxMixin(Polymer.Element))))) { + Vaadin.ThemePropertyMixin( + Vaadin.ThemableMixin( + Vaadin.ComboBoxDataProviderMixin( + Vaadin.ComboBoxMixin(Polymer.Element)))) { static get is() { return 'vaadin-combo-box-light'; @@ -124,6 +121,18 @@ super.ready(); this._toggleElement = this.querySelector('.toggle-button'); this._clearElement = this.querySelector('.clear-button'); + + if (this._clearElement) { + this._clearElement.addEventListener('mousedown', e => { + e.preventDefault(); // Prevent native focus changes + // _focusableElement is needed for paper-input + (this.inputElement._focusableElement || this.inputElement).focus(); + }); + } + } + + get focused() { + return this.getRootNode().activeElement === this.inputElement; } connectedCallback() { @@ -158,6 +167,7 @@ /** * Focusable element used by vaadin-control-state-mixin */ + /* get focusElement() { // Needed for focusing a paper-input properly if (this.inputElement && this.inputElement._focusableElement) { @@ -166,6 +176,7 @@ // inputElement might not be defined on property changes before ready. return this.inputElement || this; } + */ } customElements.define(ComboBoxLightElement.is, ComboBoxLightElement);