Skip to content

Fix: autosubmit no longer ignores the space key and some punctuation - #1303

Merged
radimvaculik merged 1 commit into
contributte:masterfrom
dg:fix/autosubmit-key-test
Aug 14, 2026
Merged

Fix: autosubmit no longer ignores the space key and some punctuation#1303
radimvaculik merged 1 commit into
contributte:masterfrom
dg:fix/autosubmit-key-test

Conversation

@dg

@dg dg commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

isInKeyRange(e, 9, 40) tests e.key.charCodeAt(0), a leftover from the era of e.keyCode, where 9-40 stood for Tab, Enter, Shift, Esc, space and the arrows. Over e.key it is a different quantity, and the named keys it was meant to catch are already handled by the length check above it. All the range still does is keep the space key and !"#$%&'( from triggering the filter, so typing "vitamin " leaves the grid unfiltered until the next character arrives.

shouldIgnoreKey() states the rule directly: a printable character always changes the value, a named key never does unless it is Backspace or Delete. isInKeyRange() and isFunctionKey() stay exported, the plugin just no longer uses them.

isInKeyRange(e, 9, 40) tests e.key.charCodeAt(0), a leftover from the era
of e.keyCode, where 9-40 stood for Tab, Enter, Shift, Esc, space and the
arrows. Over e.key it is a different quantity, and the named keys it was
meant to catch are already handled by the length check above it. All the
range still does is keep the space key and !"#$%&'( from triggering the
filter, so typing "vitamin " leaves the grid unfiltered until the next
character arrives.

shouldIgnoreKey() states the rule directly: a printable character always
changes the value, a named key never does unless it is Backspace or
Delete. isInKeyRange() and isFunctionKey() stay exported, the plugin just
no longer uses them.
Copilot AI lite review requested due to automatic review settings August 9, 2026 17:54
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.12%. Comparing base (ab5506d) to head (efd9ad1).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1303   +/-   ##
=======================================
  Coverage   49.12%   49.12%           
=======================================
  Files          63       63           
  Lines        2974     2974           
=======================================
  Hits         1461     1461           
  Misses       1513     1513           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes autosubmit’s key-filtering logic so that typing space and certain punctuation correctly triggers autosubmit, by replacing the legacy “key range” heuristic with an explicit “ignore named keys except editing keys” rule.

Changes:

  • Add shouldIgnoreKey() utility to classify keys to ignore for autosubmit.
  • Update Autosubmit plugin keyup handling to use shouldIgnoreKey() instead of isInKeyRange() / isFunctionKey().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
assets/utils.ts Adds shouldIgnoreKey() helper used to decide which keyups should be ignored.
assets/plugins/features/autosubmit.ts Switches autosubmit key filtering to shouldIgnoreKey() to stop ignoring space and punctuation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread assets/utils.ts
Comment on lines +19 to +24
export function shouldIgnoreKey(e: KeyboardEvent): boolean {
if (e.key.length === 1) { // Printable characters always change the input value
return false;
}
return e.key !== "Backspace" && e.key !== "Delete";
}
@radimvaculik
radimvaculik merged commit db3af3e into contributte:master Aug 14, 2026
10 checks passed
@radimvaculik

Copy link
Copy Markdown
Member

Díky, mergnuto. 🙏

Trefná diagnóza — `isInKeyRange(e, 9, 40)` byl skutečně pozůstatek po `e.keyCode` a moje dvě předchozí záplaty (ae9e9be, c9835f1) ten rozsah jen obcházely, místo aby ho zrušily. `shouldIgnoreKey()` říká pravidlo přímo a je o jednu vrstvu výš, kam patří.

Připomínku Copilota k surrogate pairs beru jako teoretickou — emoji picker vkládá text přes `input`/composition, ne přes `keyup`.

Samostatně ještě dořeším, že celý přístup přes `keyup` nechytá vložení myší, autofill, IME a na Androidu často přijde `e.key === "Unidentified"`. Správně to patří na `input` event, ale to je na jiný PR.

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

Successfully merging this pull request may close these issues.

3 participants