question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with DayPicker Overlay focus and hiding

See original GitHub issue

Hi When I am using day picker with custom input field, there is one problem. After focusing on DayPickerOverlay, click on any place on the screen calls only onOverlayFocus handler, not onBlur That`s why after overlay had been focused once I cant close it by click on some other area on the screen. What can I do for solving this problem?

Thanks

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

1reaction
gitpashcommented, Sep 8, 2019

@zovcharov seems like UX issue, can suggest only workaround like this you need just createRef on DayPickerInput

ref={inputRef}
dayPickerProps={{
          // other props
          onBlur: () => {
            const activeElement = document.activeElement;
            const overlayContainer = document.getElementsByClassName('DayPickerInput-Overlay');

            if (overlayContainer && !overlayContainer[0].contains(activeElement)) {
              inputRef.current.hideAfterDayClick();
            }
          }
        }}
0reactions
Ahmad-Zahidcommented, Nov 30, 2021

@Kamilius can you please share your custom hook solution in detail?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: React-day-picker Daypicker Input loses focus when ...
My problem was in losing focus from the picker input when opening or clicking on the custom overlay, and the 'keepFocus' prop is...
Read more >
gpbl/react-day-picker - Gitter
im trying to display events on the day calendar, but i am running into the following difficulty. If I move over a month,...
Read more >
DayPickerInput API – react-day-picker docs
Hide the overlay when the user clicks on a day cell. ... Keep focus on the input field after switching the focus into...
Read more >
Tooltip | Components - BootstrapVue
Triggering tooltips on hidden elements will not work. Specify container as null (default, appends to <body> ) to avoid rendering problems in more...
Read more >
Date Picker | Components | Vaadin Docs
The overlay opens when the field is clicked and/or any input is entered when the field is focused. Common Input Field Features. Date...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found