]> git.immae.eu Git - github/fretlink/time-picker.git/commitdiff
select text when focusing time input
authorLevi Lansing <helives@gmail.com>
Thu, 28 Sep 2017 14:15:29 +0000 (10:15 -0400)
committerLevi Lansing <helives@gmail.com>
Thu, 28 Sep 2017 14:15:29 +0000 (10:15 -0400)
src/Header.jsx

index 9e80a9ccd18e738161a44838767e166c35717352..6bed557af2b54b1115ed920313b90e1c18a7a359 100644 (file)
@@ -38,7 +38,10 @@ class Header extends Component {
     if (this.props.focusOnOpen) {
       // Wait one frame for the panel to be positioned before focusing
       const requestAnimationFrame = (window.requestAnimationFrame || window.setTimeout);
-      requestAnimationFrame(() => this.refs.input.focus());
+      requestAnimationFrame(() => {
+        this.refs.input.focus();
+        this.refs.input.select();
+      });
     }
   }