You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### TL;DR
Refactor space-triggered AI Widget activation logic from `keydown` to `keypress` event listeners
### Background
The `keydown` event triggered by a space may originate from:
1. Normal space insertion
2. Space triggered by input method confirming candidate words
In scenarios like (2), some browsers (see [ISSUE](#11541)) and input method callbacks produce events identical to scenario (1),making it impossible to distinguish between the two.
To fix this, the space-activated AI listener uses the `keypress` event:
In scenario 2, `event.which !== 32` (may be `30430` or other values) can be used to differentiate from scenario 1.
> CLOSE BS-3081
What happened?
Steps to reproduce:
Expected behavior:
Actual behavior:
Screenshots:
Distribution version
Web (https://app.affine.pro)
App Version
0.21.0
What browsers are you seeing the problem on if you're using web version?
Chrome
Are you self-hosting?
Self-hosting Version
No response
Relevant log output
Anything else?
The problem seems to lie in
AFFiNE/packages/frontend/core/src/blocksuite/ai/entries/space/setup-space.ts
Lines 7 to 26 in 205cd7a
In this case, the key code of the event is the 32 (Space) instead of the 229 (Processing).
The text was updated successfully, but these errors were encountered: