Re: [w3c/uievents] Clarify `keypress` event handling for keys that map to non-BMP Unicode symbols (Issue #346)

> @drwez do you object to having the existing keypress behaviours better-described by the non-normative portion of the spec? If so then could you provide a specific alternative proposal?

Currently the spec doesn't define the behavior of `charCode` at all, and there are major inconsistencies with `charCode` in the different browsers. The spec even [explicitly says](https://www.w3.org/TR/uievents/#idl-keyboardeventinit):

> In practice, keyCode and charCode are inconsistent across platforms and even the same implementation on different operating systems or using different localizations. This specification does not define values for either keyCode or charCode, or behavior for charCode.

Although it's a legacy API, it's still commonly used, so it's still important for its behavior to be consistent among browsers.

Ideally the spec should be changed so that `charCode` is more tightly specified (perhaps aligning with Safari), and that `charCode` should never contain surrogate pairs.

If those spec changes cannot be made (for compat reasons), then we just have to accept that.

So the big question is: how likely are there to be compat issues if Chrome / Firefox align to Safari's behavior? That will decide what sort of spec changes (if any) need to be made.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/346#issuecomment-1631165289
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/uievents/issues/346/1631165289@github.com>

Received on Tuesday, 11 July 2023 16:53:31 UTC