Fix: autosubmit dropped when modifier keyup follows a character keyup#1284
Fix: autosubmit dropped when modifier keyup follows a character keyup#1284jaroslavlibal wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1284 +/- ##
=======================================
Coverage 46.79% 46.79%
=======================================
Files 53 53
Lines 2729 2729
=======================================
Hits 1277 1277
Misses 1452 1452 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Move the skip-keys predicate out of the debounce wrapper so a late modifier or nav keyup can't overwrite the pending submit's target event and silence submitForm. Also let Unidentified through the predicate — virtual keyboards dispatch it. Bind Enter to immediate submit.
|
Force-pushed an expanded version of the fix: testing on mobile revealed a second autosubmit regression with the same root cause — virtual keyboards (e.g. Android Chrome / Gboard) dispatch keyup with Added |
|
@jaroslavlibal Could you fix CI? |
|
Hi @radimvaculik , those errors come from master and I'd rather not touch them - I don't have enough context to judge whether the I can probably drop those |
Problem
After typing into a
data-autosubmitfilter input, runningCtrl+A→Ctrl+X(releasingCtrlbetween) leaves the grid filtered to the old value —submitFormnever fires on the now-empty input.Ctrl+Vafterwards puts pasted text in the input but the filter still doesn't re-run. HoldingCtrldown throughout avoids it.Cause
Each shortcut ends with a
Controlkeyup right after the character keyup. The skip-keys predicate sits inside thedebounce()wrapper, so the debounce keeps resetting and ends up firing for theControlevent.isInKeyRangereturnstruefor multi-char named keys after ae9e9be / c9835f1, the handler early-returns andsubmitFormnever runs. Same shape also affectsTaband Arrow keys arriving after a character keyup.Fix
Move the skip predicate out of
debounce(), into the listener. Modifier and nav keyups no longer reset the debounce timer, so the pending character keyup's submit fires as intended.isInKeyRangeitself is untouched.Also bind Enter to immediate submit, no debounce wait.
Verification
Live-tested in our project with browser-side keyup instrumentation. With the fix the debounce stays anchored to the character keyup and
submitFormruns.¹ The skeleton demo at https://examples.contributte.org/datagrid-skeleton/filters/ doesn't reproduce the bug only because its deployed
composer.lockpinsublaboo/datagridtodev-master @ bf8b0e0(pre-regression), even thoughcomposer.jsonis^7.2. Freshcomposer installof the skeleton today resolves tov7.2.0and reproduces.² Side note:
package.json'sversionfield is7.1.0on thev7.2.0tag (and6.9.2onv7.0.0). Looks like releases don't bump it.