This is the kind of issue that KeyboardMap (
https://wicg.github.io/keyboard-map/) is meant to address.

`keyCode` is not well defined, so once you get outside the common keys you
see implementation differences between browsers and OSs. So there is no
real path to creating a specification for it. Hence it is deprecated
because it is not reliable.

Also, this issue is about `keyIdentifier`, which Safari briefly supported.
As of today, Safari supports `key` and `code`, so the concerns about not
having a fallback for `keyIdentifier` are no longer relevant.

-Gary

On Mon, Nov 6, 2023 at 1:18 PM Lorand Zudor <[email protected]> wrote:

> Hi All,
>
> Despite the fact that the given thread is from 2016 I think there's still
> a scenario which can be resolved only using deprecated properties (
> KeyboardEvent.keyCode or UIEvent.which).
> Consider the following scenario:
> - there is a given shortcut in a web app mapped for Control+Alt+Z
> (alternatively Command+Option+Z for MacOs)
> - let's also assume the user is having a qwertz
> <https://en.wikipedia.org/wiki/QWERTZ> keyboard layout set
> - on Mac, once Command+Option+Z is pressed, one can detect the right
> combination only by using keyCode, since:
> -- event.keyCode will be 90 (ASCII for "Z")
> -- event.code takes "KeyY" (physical key)
> -- event.key will be "Ź" (ASCII: 377); on default ABC layout is "Ω", so
> that wouldn't work, either
>
> Best,
> - Lorand.
>
> On Friday, September 9, 2016 at 2:09:35 AM UTC+3 Gary Kačmarčík
> (Кошмарчик) wrote:
>
> We haven't heard anything from Apple regarding updating WebKit to use
> |code| and |key|, so they don't have a non-deprecated alternative.
>
> We'll hopefully learn more about their plans during TPAC (later this
> month), but for now Safari users need to fall back to the (also deprecated)
> |keyCode| and |charCode| attributes. But as mentioned earlier, this
> attribute was never widely implemented and was only included in the
> standard for a very short period of time.
>
>
> On Thu, Sep 8, 2016 at 3:19 PM, 'Joe Medley' via blink-dev <
> [email protected]> wrote:
>
> I'm writing a notice about this for this page
> <https://developers.google.com/web/updates/tags/deprecations>. Does
> anyone know what the alternative is for Safari?
>
> Joe
>
> Joe Medley | Technical Writer, Chrome DevRel | [email protected] |
> 816-678-7195
> *If an API's not documented it doesn't exist.*
>
> On Wed, Apr 27, 2016 at 4:19 PM, Dave Tapuska <[email protected]>
> wrote:
>
> Primary eng (and PM) emails
>
> [email protected]
>
> Summary
>
> Mark the field keyIdentifier on KeyboardEvent.idl as deprecated.
>
> Motivation
>
> There is a standardized KeyboardEvent.key which other vendors implement.
> Deprecating the feature is desired to drive adoption of the newly available
> key field.
>
> Compatibility Risk
>
> Edge, and FireFox do not implement this field so web developers have had
> to work around the issue for some time.
>
>
> Alternative implementation suggestion for web developers
>
> Use KeyboardEvent.key
>
> Usage information from UseCounter
> <https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/page/UseCounter.h&sq=package:chromium&type=cs&q=file:UseCounter.h%20Feature&l=39>
>
> The use counter is relatively high with 0.2155%. But I do believe this
> usage value is inflated due to cloning of all fields in Events by
> delegation frameworks.
>
>
> https://www.chromestatus.com/metrics/feature/popularity#V8KeyboardEvent_KeyIdentifier_AttributeGetter
>
> OWP launch tracking bug
>
> crbug.com/607349
>
> Entry on the feature dashboard <https://www.chromestatus.com/>
>
> https://www.chromestatus.com/features/5316065118650368
>
>
> Requesting approval to remove too?
>
> No. Ideally since this has been around for a while; I'd like to give
> probably 4 releases to fully deprecate it. So probably M56. But ideally the
> motivation of doing this is to call out the usage of KeyboardEvent.key
> instead.
>
> --
> You received this message because you are subscribed to the Google Groups
> "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAGnkXoGf%3DS7-MRQGt%2Bfy_VZEBGhtZ-1dj9Cq0VttNcsr1Pf0xg%40mail.gmail.com.

Reply via email to