diff --git a/package.json b/package.json index f405800..67d873b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@julmot/form-components", - "version": "1.1.3", + "version": "1.1.4", "description": "Custom Form Components. Without Any Framework. Accessible.", "keywords": [ "form", diff --git a/src/components/_common/_fonts.scss b/src/components/_common/_fonts.scss index bd6fae3..e068904 100644 --- a/src/components/_common/_fonts.scss +++ b/src/components/_common/_fonts.scss @@ -1,6 +1,6 @@ @font-face { font-family: "form-components-icons"; - src: url("../../fonts/form-components-icons/form-components-icons.woff?2281ab3a92848f43e971c33de7b726d3") format("woff"); + src: url("../../fonts/form-components-icons/form-components-icons.woff?65b1e42927684e703d14d95aa39a85f6") format("woff"); font-weight: normal; font-style: normal; } diff --git a/src/components/select/select-material-like/select-material-like.js b/src/components/select/select-material-like/select-material-like.js index 8c75ffb..b96a7d8 100644 --- a/src/components/select/select-material-like/select-material-like.js +++ b/src/components/select/select-material-like/select-material-like.js @@ -54,17 +54,16 @@ export class Select extends FormComponent { }); }); } + // blur event.explicitOriginalTarget isn't cross-browser compatible. To check whether the blur event wasn't + // caused by a mousedown inside the dropdown, catch the event beforehand + let clicky = null; + this.context.addEventListener('mousedown', event => clicky = event.target); + this.context.addEventListener('mouseup', () => clicky = null); this.field.addEventListener('blur', () => { if (!this.field.hasAttribute('disabled')) { - // Make sure to not close the dropdown before the option click event - // is called. Otherwise you can't select any value using click - setTimeout(() => { - const target = document.activeElement; - if (target === this.context || this.context.contains(target)) { - return; - } + if (clicky === null || (this.context !== clicky && !this.context.contains(clicky))) { this.close(); - }, 150); + } } }); } diff --git a/src/fonts/form-components-icons/form-components-icons.woff b/src/fonts/form-components-icons/form-components-icons.woff index 306d657..a90c43f 100644 Binary files a/src/fonts/form-components-icons/form-components-icons.woff and b/src/fonts/form-components-icons/form-components-icons.woff differ