BlockNote icon indicating copy to clipboard operation
BlockNote copied to clipboard

fix(link-toolbar): prevent Enter from submitting during IME composition

Open hanios123 opened this issue 1 month ago • 3 comments

Summary

Prevent the link toolbar form from submitting when the user presses Enter during IME (Input Method Editor) composition.

Rationale

When users type in languages that require IME input methods (e.g., Japanese, Chinese, Korean), they press Enter to confirm character conversions (e.g., converting hiragana to kanji). Without this fix, pressing Enter during composition would prematurely submit the link form instead of completing the character input, breaking the editing experience for CJK users.

Changes

  • Added a check for event.nativeEvent.isComposing in the handleEnter callback within EditLinkMenuItems.tsx
  • The handler now returns early if the keyboard event is part of an ongoing IME composition session

Impact

  • No breaking changes – This only adds a guard condition
  • Improves accessibility and usability for users typing in CJK languages
  • Existing functionality for non-IME users remains unchanged

Testing

  • Manual testing: Verified with Japanese IME (macOS) that Enter key during kanji conversion no longer submits the form, and Enter after composition completes works as expected
  • Tested that normal (non-IME) Enter key behavior still submits the link correctly

Screenshots/Video

https://github.com/user-attachments/assets/2cd5ebe6-704c-4083-9c8d-211bb2ca914e

Checklist

  • [X] Code follows the project's coding standards.
  • [ ] Unit tests covering the new feature have been added.
  • [X] All existing tests pass.
  • [ ] The documentation has been updated to reflect the new feature

hanios123 avatar Jan 15 '26 10:01 hanios123

@hanios123 is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jan 15 '26 10:01 vercel[bot]

This is great @hanios123 I would merge this, but I'd probably go around to check whether we have this issue in other places or not first. And I don't have the time to dive into that at this time.

nperez0111 avatar Jan 15 '26 16:01 nperez0111

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/ariakit@2361
@blocknote/code-block

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/code-block@2361
@blocknote/core

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/core@2361
@blocknote/mantine

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/mantine@2361
@blocknote/react

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/react@2361
@blocknote/server-util

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/server-util@2361
@blocknote/shadcn

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/shadcn@2361
@blocknote/xl-ai

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-ai@2361
@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-docx-exporter@2361
@blocknote/xl-email-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-email-exporter@2361
@blocknote/xl-multi-column

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-multi-column@2361
@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-odt-exporter@2361
@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/TypeCellOS/BlockNote/@blocknote/xl-pdf-exporter@2361

commit: 0795d1c

pkg-pr-new[bot] avatar Jan 15 '26 17:01 pkg-pr-new[bot]

Thanks @matthewlipski this is exactly what I'd have expected

nperez0111 avatar Jan 27 '26 07:01 nperez0111