Skip to content

Commit 3c7dd3b

Browse files
committed
Fix autofocus not working on IE11
1 parent 792c8c0 commit 3c7dd3b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/DateInput/Input.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ import { isRef } from '../shared/propTypes';
88

99
/* eslint-disable jsx-a11y/no-autofocus */
1010

11-
const isEdgeLegacy = (
11+
const isIEOrEdgeLegacy = (
1212
typeof window !== 'undefined'
13-
&& 'navigator' in window
14-
&& navigator.userAgent.match(/ Edge\/1/)
13+
&& /(MSIE|Trident\/|Edge\/)/.test(window.navigator.userAgent)
1514
);
1615

1716
function onFocus(event) {
1817
const { target } = event;
1918

20-
if (isEdgeLegacy) {
19+
if (isIEOrEdgeLegacy) {
2120
requestAnimationFrame(() => target.select());
2221
} else {
2322
target.select();

0 commit comments

Comments
 (0)