Skip to content

Improve searchbox event handling#695

Merged
gibson042 merged 1 commit into
tc39:mainfrom
gibson042:2026-05-searchbox-events
May 3, 2026
Merged

Improve searchbox event handling#695
gibson042 merged 1 commit into
tc39:mainfrom
gibson042:2026-05-searchbox-events

Conversation

@gibson042
Copy link
Copy Markdown
Member

  • use "input" rather than "keyup" to respond to value changes, catching previously ignored interactions such as Paste and avoiding the need to special-case Enter/Tab/etc. since those don't trigger an "input" event
  • call preventDefault in the synchronous listener rather than in the debounced function when it's too late
  • drop attempted "/" suppression, since it wasn't working anyway and apparently hasn't been a problem
  • consolidate "keydown"/"input" handling into a single debounced listener that switches on event type for deciding its behavior

* use "input" rather than "keyup" to respond to value changes, catching
  previously ignored interactions such as Paste and avoiding the need to
  special-case Enter/Tab/etc. since those don't trigger an "input" event
* call `preventDefault` in the synchronous listener rather than in the debounced
  function when it's too late
* drop attempted "/" suppression, since it wasn't working anyway and apparently
  hasn't been a problem
* consolidate "keydown"/"input" handling into a single debounced listener that
  switches on event type for deciding its behavior
@gibson042 gibson042 requested a review from bakkot May 3, 2026 08:13
Copy link
Copy Markdown
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

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

Thanks!

@gibson042 gibson042 merged commit bd0b81c into tc39:main May 3, 2026
2 checks passed
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.

2 participants