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

Many onBlur events while clicking through days #623

Open
vdboor opened this issue Jul 31, 2024 · 0 comments
Open

Many onBlur events while clicking through days #623

vdboor opened this issue Jul 31, 2024 · 0 comments

Comments

@vdboor
Copy link

vdboor commented Jul 31, 2024

The input field will receive ongoing onblur events while clicking through the datepicker.

While seemingly innocent, I've run into this because we update a huge calculation on blur events of every input field.

My current fix is:

const datePicker = new AirDatepicker(el, {...});
el.addEventListener('blur', (event) => {
        // The 'blur' event happens all the time while clicking through the date picker.
        // It will try to restore "focus" on the field, which will blur gain on the next click.
        if (datePicker.inFocus) {
            event.stopImmediatePropagation();
        }
    });
@vdboor vdboor changed the title Many onBlur events in Firefox Many onBlur events while clicking through days Jul 31, 2024
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

1 participant