Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing in the year in the custom range date picker no longer works #831

Closed
metmarkosaric opened this issue Mar 12, 2021 · 3 comments
Closed

Comments

@metmarkosaric
Copy link
Contributor

I've tried this on my own and can replicate the issue.

6aiGhtfZ png medium

(reported via twitter dm)

@ukutaht
Copy link
Contributor

ukutaht commented Mar 31, 2021

This regression was introduced in #735. The site switching keybindings are interfering with entering numbers into the datepicker.

Fixing it would require some sort of horrible global state so the site switcher can ignore the keybind when datepicker is open. @Vigasaurus any other ideas?

@Vigasaurus
Copy link
Contributor

Vigasaurus commented Mar 31, 2021

Assuming the datepicker uses a basic input element, we could just have the keydown handler check the event target for if it's of input type and break out. Or honestly, the datepicker is what handles both the keybindings and keeps the flatpickr state, so it could be as simple as checking the open state in the keydown, similar to the code below. nevermind, idk why I thought it was the datepicker keybinds interfering

Something like:

if (['INPUT', 'TEXTAREA'].includes(e.target.tagName)) return;

...rest
e.preventDefault();

@ukutaht
Copy link
Contributor

ukutaht commented Apr 1, 2021

Fantastic @Vigasaurus that's a much better idea than introducing global state.

@ukutaht ukutaht closed this as completed in ced4f75 Apr 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants