Skip to content

js: Add and utilize function isSpecialKeypress#377

Open
nilmerg wants to merge 1 commit into
mainfrom
add-js-function-isSpecialKeypress
Open

js: Add and utilize function isSpecialKeypress#377
nilmerg wants to merge 1 commit into
mainfrom
add-js-function-isSpecialKeypress

Conversation

@nilmerg
Copy link
Copy Markdown
Member

@nilmerg nilmerg commented May 6, 2026

This is a way better implementation instead of just checking whether the pressed key's label starts with an uppercase char. (e.g. Escape) Problem is, uppercase single chars also match…

This could previously be observed when trying to type a value inside an operator input in the search bar. Normally this switches to the value input automatically, but an uppercase char was tried to identify as operator.

In the Completer implementation this uncovered dead code on the other hand. onKeyPress seems to have had the job to hide the suggestions in case the user typed one manually. Upon testing this now with an corrected check (event.key alone does not match a suggestion as it's only single char) this worked but the suggestions appeared immediately again. I've removed it now as it was broken prior and doesn't make any sense either nowadays, suggestions need to be always visible in order to confirm the validity of the input.

This is a way better implementation instead of just checking
whether the pressed key's label starts with an uppercase char.
(e.g. `Escape`) Problem is, uppercase single chars also match…

This could previously be observed when trying to type a value
inside an operator input in the search bar. Normally this
switches to the value input automatically, but an uppercase
char was tried to identify as operator.

In the `Completer` implementation this uncovered dead code
on the other hand. `onKeyPress` seems to have had the job to
hide the suggestions in case the user typed one manually.
Upon testing this now with an corrected check (`event.key`
alone does not match a suggestion as it's only single char)
this worked but the suggestions appeared immediately again.
I've removed it now as it was broken prior and doesn't make
any sense either nowadays, suggestions need to be always
visible in order to confirm the validity of the input.
Copy link
Copy Markdown

Copilot AI left a comment

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 improves keyboard handling in the search/filter inputs by replacing a brittle “uppercase key label” heuristic with a dedicated helper that detects non-character (special/control) key presses. It also removes dead/broken suggestion-hiding logic in the completer.

Changes:

  • Added a shared JS helper isSpecialKeyPress(event) and started using it in filter/input key handling.
  • Updated FilterInput and BaseInput to use the shared helper instead of an uppercase-label regex.
  • Removed the unused/broken default-case logic from Completer.onKeyDown() that attempted to hide suggestions.

Reviewed changes

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

File Description
asset/js/widget/FilterInput.js Imports and uses the new helper to ignore special/control key presses during context switching logic.
asset/js/widget/BaseInput.js Imports and uses the new helper to avoid clearing syntax errors on control/special key presses.
asset/js/widget/Completer.js Removes dead code in keydown handling that attempted to hide suggestions based on typed keys.
asset/js/functions.js Introduces isSpecialKeyPress(event) as a reusable helper module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread asset/js/functions.js
* @returns {boolean} True if the event represents a special key press, false otherwise.
*/
function isSpecialKeyPress(event) {
return event.key.length > 1 || event.ctrlKey || event.metaKey;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants