From ebf24bcaa11a6e313c74ff47e19876e4c26fe616 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 13 Nov 2019 13:51:11 +0800 Subject: [PATCH] fix TimePicker cause jump occasionally https://github.com/ant-design/ant-design/pull/19698#issuecomment-553237671 --- .gitignore | 1 - src/Header.jsx | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ba5c1b41..d9a18ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ coverage yarn.lock es/ package-lock.json -src/*.js src/*.map .prettierrc tslint.json diff --git a/src/Header.jsx b/src/Header.jsx index ce4338ef..4932382b 100644 --- a/src/Header.jsx +++ b/src/Header.jsx @@ -22,10 +22,11 @@ class Header extends Component { // requestAnimationFrame will cause jump on rc-trigger 3.x // https://github.com/ant-design/ant-design/pull/19698#issuecomment-552889571 // use setTimeout can resolve it + // 60ms is a magic timeout to avoid focusing before dropdown reposition correctly this.timeout = setTimeout(() => { this.refInput.focus(); this.refInput.select(); - }); + }, 60); } }