Skip to content

fix: dead-key layouts cannot type the apostrophe and the composition space skips the word - #305

Open
Ukly0 wants to merge 2 commits into
zyronon:masterfrom
Ukly0:fix/dead-key-composition
Open

fix: dead-key layouts cannot type the apostrophe and the composition space skips the word#305
Ukly0 wants to merge 2 commits into
zyronon:masterfrom
Ukly0:fix/dead-key-composition

Conversation

@Ukly0

@Ukly0 Ukly0 commented Aug 22, 2026

Copy link
Copy Markdown

On layouts with dead keys (Spanish, French, US-International, Nordic...),
an apostrophe requires pressing the dead key and then Space, but that
composition Space is consumed by the OS — not a real separator — yet it
was treated as one, skipping the word being typed. Chromium/Gecko also
report the dead key as key='Dead', which ended up in the input literally.

Changes:

  • drop plain key='Dead' keydowns; the actual character is delivered by
    the OS composition through the hidden input's input event
  • swallow the Space that terminates a dead-key composition (both the
    key='Dead' path and the composition-events path while composing)
  • show the existing "switch to English input" warning only for real
    CJK/IME output, so dead-key layouts stop getting spammed by it
  • add unit tests covering the dead-key swallow, plain-English
    no-regression and state reset

Fixes #304

…l, Nordic...)

Keydown handling assumed a plain US-English keyboard, so any layout where
' ^ ~ etc. are dead keys could not type those characters: browsers report
the dead key as key='Dead' (which entered the input as literal 'Dead'
text) and the composition-terminating Space was treated as a real word
separator, skipping/hiding the word being typed.

- Dead keys (key='Dead') are dropped from the keydown pipeline; the actual
  character is delivered by the OS composition via the existing hidden
  input's input event (layout-agnostic)
- The Space that terminates a dead-key composition is swallowed so it is
  not treated as a word separator
- Also covers browsers that report dead keys as their base character:
  a pending-composition state is confirmed/cleared when a real character
  lands in the hidden input, so plain English layouts are unaffected
- Unit tests cover both reporting models and the no-regression case
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

@Ukly0 is attempting to deploy a commit to the zyronon's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Ukly0 Ukly0 closed this Aug 22, 2026
@Ukly0

Ukly0 commented Aug 22, 2026

Copy link
Copy Markdown
Author

Closing for now — this fix needs further verification on real devices/setups before being submitted. Will reopen once verified. Thanks! (中文:暂时关闭,修复还需在真实设备上进一步验证,之后再重新提交。谢谢!)

@zyronon

zyronon commented Aug 22, 2026

Copy link
Copy Markdown
Owner

ok

…macOS)

- Drop key='Dead' keydowns: the real character is delivered by the OS via the
  hidden input's input event (layout-agnostic)
- Swallow the Space that terminates a dead-key composition (both the
  key='Dead' path and the composition-event path while isComposing)
- Skip composition input events so the reset sentinel space is not
  re-dispatched as a phantom character (Firefox fires input after
  compositionend)
- Show the 'switch to English' warning only for real CJK IME output, so
  dead-key layouts (es, US-Intl...) no longer get a spurious warning
- Unit tests: dead-key swallow, English no-regression, state reset
@Ukly0 Ukly0 reopened this Aug 23, 2026
@Ukly0

Ukly0 commented Aug 23, 2026

Copy link
Copy Markdown
Author

Verified on dead-key layouts (Chromium on Linux, Firefox on macOS); reopening.

@Ukly0 Ukly0 changed the title fix: typing broken on keyboard layouts with dead keys (es, fr, US-Intl, Nordic…) fix: dead-key layouts cannot type the apostrophe and the composition space skips the word Aug 23, 2026
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.

Typing broken on keyboard layouts with dead keys (es, fr, US-Intl, Nordic…): apostrophe untypable and word gets skipped

2 participants