From bd172943d28982d751cfb6b9c7a7c731728bace1 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 10 Mar 2019 10:35:07 -0700 Subject: [PATCH] fix webkit CSS, fix clear button --- css/emoji-mart.css | 8 ++++++++ src/components/search.js | 13 ++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/css/emoji-mart.css b/css/emoji-mart.css index d4ddbeb..9a73f5a 100644 --- a/css/emoji-mart.css +++ b/css/emoji-mart.css @@ -100,6 +100,14 @@ border-radius: 5px; border: 1px solid #d9d9d9; outline: 0; +} + +.emoji-mart-search input::-webkit-search-decoration, +.emoji-mart-search input::-webkit-search-cancel-button, +.emoji-mart-search input::-webkit-search-results-button, +.emoji-mart-search input::-webkit-search-results-decoration { + /* remove webkit/blink styles for + * via https://stackoverflow.com/a/9422689 */ -webkit-appearance: none; } diff --git a/src/components/search.js b/src/components/search.js index cfaf3b1..67d8c56 100644 --- a/src/components/search.js +++ b/src/components/search.js @@ -49,6 +49,7 @@ export default class Search extends React.PureComponent { clear() { if (this.input.value == '') return this.input.value = '' + this.input.focus() this.search('') } @@ -62,20 +63,13 @@ export default class Search extends React.PureComponent { } } - clearIfNotSearching() { - const { isSearching } = this.state - if (!isSearching) { - this.clear() - } - } - setRef(c) { this.input = c } render() { const { i18n, autoFocus } = this.props - const { icon, id } = this.state + const { icon, isSearching, id } = this.state const inputId = `emoji-mart-search-${id}` return ( @@ -97,9 +91,10 @@ export default class Search extends React.PureComponent {