From 328dec919100648518e9871b5329a62f7d886957 Mon Sep 17 00:00:00 2001 From: Rolf Timmermans Date: Wed, 20 Dec 2017 18:25:35 +0100 Subject: [PATCH 1/2] Improve behaviour on blur I'm using something similar to the following code. This is one of the examples from https://ant.design/components/select/ ``` ``` When typing "jack" and then pressing TAB, the dropdown box briefly expands just before closing again. This patch fixes that behaviour by setting the open state to closed just before firing the change, instead of afterwards. --- src/Select.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Select.jsx b/src/Select.jsx index c74d75a3c..05dab2013 100644 --- a/src/Select.jsx +++ b/src/Select.jsx @@ -381,6 +381,11 @@ export default class Select extends React.Component { label: this.getLabelFromOption(firstOption), }, ]; + + /* Close dropdown so the unfiltering caused by fireChange() + does not cause the dropdown to animate and expand just + before closing again. */ + this.setOpenState(false); this.fireChange(value); } } From 69890f4d3fd529a1f2b4dcafc11038f10b73c2b5 Mon Sep 17 00:00:00 2001 From: Rolf Timmermans Date: Wed, 20 Dec 2017 18:34:09 +0100 Subject: [PATCH 2/2] Update Select.jsx --- src/Select.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Select.jsx b/src/Select.jsx index 05dab2013..d95b86ffa 100644 --- a/src/Select.jsx +++ b/src/Select.jsx @@ -381,7 +381,7 @@ export default class Select extends React.Component { label: this.getLabelFromOption(firstOption), }, ]; - + /* Close dropdown so the unfiltering caused by fireChange() does not cause the dropdown to animate and expand just before closing again. */