Skip to content

Commit

Permalink
Set clear button not opening the overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy-fix committed Feb 27, 2018
1 parent fe57b2e commit 28c063d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/vaadin-date-picker-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@
value: true
},

_cleared: Boolean,

_focusOverlayOnOpen: Boolean
};
}
Expand Down Expand Up @@ -340,9 +342,12 @@
* Opens the dropdown.
*/
open() {
if (!this.disabled && !this.readonly) {
if (!this.disabled && !this.readonly && !this._cleared) {
this.$.overlay.opened = true;
this._updateAlignmentAndPosition();
} else if (this._cleared) {
this._inputElement.focus();
this._cleared = false;
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/vaadin-date-picker.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
part="text-field"
>
<slot name="prefix" slot="prefix"></slot>
<div part="clear-button" slot="suffix" on-tap="_clear" role="button" aria-label$="[[i18n.clear]]"></div>
<div part="clear-button" slot="suffix" on-touchstart="_preventDefault" on-tap="_clear" role="button" aria-label$="[[i18n.clear]]"></div>
<div part="toggle-button" slot="suffix" on-tap="_toggle" role="button" aria-label$="[[i18n.calendar]]" aria-expanded$="[[_getAriaExpanded(opened)]]"></div>
</vaadin-text-field>

Expand Down Expand Up @@ -268,7 +268,8 @@
}
}

_clear() {
_clear(e) {
this._cleared = e.target === this.shadowRoot.querySelector('[part~="clear-button"]');
this.value = '';
this.validate();
}
Expand Down

0 comments on commit 28c063d

Please sign in to comment.