File tree 1 file changed +4
-5
lines changed 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,6 @@ export const Calendar = React.memo(
24
24
const [ overlayVisibleState , setOverlayVisibleState ] = React . useState ( false ) ;
25
25
const [ viewDateState , setViewDateState ] = React . useState ( null ) ;
26
26
const [ idState , setIdState ] = React . useState ( props . id ) ;
27
- const isTypingRef = React . useRef ( false ) ;
28
27
29
28
const metaData = {
30
29
props,
@@ -148,7 +147,6 @@ export const Calendar = React.memo(
148
147
const value = parseValueFromString ( props . timeOnly ? rawValue . replace ( '_' , '' ) : rawValue ) ;
149
148
150
149
if ( isValidSelection ( value ) ) {
151
- isTypingRef . current = true ;
152
150
updateModel ( event , value ) ;
153
151
updateViewDate ( event , value . length ? value [ 0 ] : value ) ;
154
152
}
@@ -3074,12 +3072,13 @@ export const Calendar = React.memo(
3074
3072
const newDate = props . value ;
3075
3073
3076
3074
if ( previousValue !== newDate ) {
3077
- if ( ! isTypingRef . current ) {
3075
+ const isInputFocused = document . activeElement === inputRef . current ;
3076
+
3077
+ // Do not update value in input if user types something in it:
3078
+ if ( ! isInputFocused ) {
3078
3079
updateInputfield ( newDate ) ;
3079
3080
}
3080
3081
3081
- isTypingRef . current = false ;
3082
-
3083
3082
// #3516 view date not updated when value set programatically
3084
3083
if ( ! newDate ) return ;
3085
3084
You can’t perform that action at this time.
0 commit comments