Closed balajis-qb closed 3 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 96.73%. Comparing base (
8e7dbce
) to head (59a42e3
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Closes #4844
Description
Retain the open state of the calendar popup on document visibility change.
Problem As mentioned in the issue description, the calendar gets auto-reopen whenever we switch the browser tab and switch back to the original tab in any of the below 2 cases
In any of the above cases the input is focused while switching the browser tab and when we switch back to the original tab, the browser refocus the calendar input, which will trigger our
handleFocus
handler in our code and we open the calendar popup regardless of it's previous open stateChanges As a fix, I listened for the
visibilitychange
event and note whenever the tab gots hidden. Whenever the input gets refocused, if it gets auto re-focused because of the browservisibilitychange
, I used the previous open state to decide whether to re-open the calendar popup or not.Basically the solution I suggested helps to retain the previous open state of the calendar popup whenever the browser gets re-opened.
Contribution checklist