Date input triggers autosubmit as soon as user starts typing the year

Created on 25 July 2022, over 2 years ago
Updated 12 September 2024, 3 months ago

Problem/Motivation

The auto_submit.js code handles change and keyup events for the exposed form.
The change event triggers autosubmit immediately while keyup waits for autosubmit delay (using Drupal.debounce; default setting is 500ms) before submitting.

The problem is that the date input emits change input as soon as the date is valid (even if user is still typing), e.g. typing 2222 would result in submitting 22/02/0002 (or 02/22/0002).

Here's a JSFiddle demonstrating this behaviour:
https://jsfiddle.net/0ozx1vkd/

Because of this, autosubmit trigger may prevent user from typing the date since AJAX call would replace the View and the exposed form.

I've tested on Chrome 103 and Firefox 102, both running on Linux.

Steps to reproduce

1. Create a view with exposed date filter.
2. Enable BEF autosubmit.
3. Type in the date in the field.

Expected: The exposed form would be submitted after typing.
Actual: The exposed form is submitted as soon as user types the first digits of the year.

Proposed resolution

Apply debound to change event handler specifically for date inputs.

Remaining tasks

Test and merge.

User interface changes

The patch would introduce a delay before automatic submission of the exposed form after typing in the date.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Needs review

Version

7.0

Component

Code

Created by

🇺🇦Ukraine abramm Lutsk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024