Skip to content

Commit 0bda626

Browse files
committed
Don't call e.persist in case where its not defined #706
1 parent 65158c2 commit 0bda626

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-number-format",
33
"description": "React component to format number in an input or as a text.",
4-
"version": "5.1.1",
4+
"version": "5.1.2",
55
"main": "dist/react-number-format.cjs.js",
66
"module": "dist/react-number-format.es.js",
77
"types": "types/index.d.ts",

src/number_format_base.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ export default function NumberFormatBase<BaseType = InputAttributes>(
336336
const _onFocus = (e: React.FocusEvent<HTMLInputElement>) => {
337337
// Workaround Chrome and Safari bug https://bugs.chromium.org/p/chromium/issues/detail?id=779328
338338
// (onFocus event target selectionStart is always 0 before setTimeout)
339-
e.persist();
339+
if (e.persist) e.persist();
340340

341341
const el = e.target;
342342
focusedElm.current = el;

0 commit comments

Comments
 (0)