Skip to content

Commit

Permalink
fix: get rid of ControlStateMixin in vaadin-combo-box-light
Browse files Browse the repository at this point in the history
  • Loading branch information
Haprog committed Mar 29, 2019
1 parent eaf9b33 commit 2045280
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/vaadin-combo-box-light.html
Expand Up @@ -5,7 +5,6 @@
-->

<link rel="import" href="../../polymer/polymer-element.html">
<link rel="import" href="../../vaadin-control-state-mixin/vaadin-control-state-mixin.html">
<link rel="import" href="../../vaadin-themable-mixin/vaadin-themable-mixin.html">
<link rel="import" href="../../vaadin-themable-mixin/vaadin-theme-property-mixin.html">
<link rel="import" href="vaadin-combo-box-mixin.html">
Expand Down Expand Up @@ -80,18 +79,16 @@
* </vaadin-combo-box-light>
* ```
* @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';
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand All @@ -166,6 +176,7 @@
// inputElement might not be defined on property changes before ready.
return this.inputElement || this;
}
*/
}

customElements.define(ComboBoxLightElement.is, ComboBoxLightElement);
Expand Down

0 comments on commit 2045280

Please sign in to comment.