[Question] What does brokenModifierNames mean? #16

Closed
opened 2023-06-07 01:54:45 +02:00 by philiprenich · 2 comments
philiprenich commented 2023-06-07 01:54:45 +02:00 (Migrated from github.com)

Hi, I'm helping to debug an issue in Prosemirror (by way of TipTap) where the Swedish character å is being reported as [ (the former key on a Swedish keyboard shares the location of the latter on English keyboards)

It looks like on Macs this is being misrepresented. From what I can tell, that's because brokenModifierNames is true when a Mac is being used which means the fallback of event.keyCode is used. So I'm curious why that is, what are the cases where something is "broken" and event.key by itself can't be used while on a Mac.

Tying in to that, because I haven't dug into the intricacies of all of this, across multiple languages or older browsers, I'm wondering what the use case is for this library over just using event.key naïvely? The README has no examples of where this would be useful to use, but it must be because you wrote and published a sleek little library for it :)

Thanks for the help in understanding so I can sort out a good solution upstream!

Hi, I'm helping to debug an issue in Prosemirror (by way of TipTap) where the Swedish character `å` is being reported as `[` (the former key on a Swedish keyboard shares the location of the latter on English keyboards) It looks like on Macs this is being misrepresented. From what I can tell, that's because `brokenModifierNames` is true when a Mac is being used which means the fallback of `event.keyCode` is used. So I'm curious why that is, what are the cases where something is "broken" and `event.key` by itself can't be used while on a Mac. Tying in to that, because I haven't dug into the intricacies of all of this, across multiple languages or older browsers, I'm wondering what the use case is for this library over just using `event.key` naïvely? The README has no examples of where this would be useful to use, but it must be because you wrote and published a sleek little library for it :) Thanks for the help in understanding so I can sort out a good solution upstream!
philiprenich commented 2023-06-07 02:11:47 +02:00 (Migrated from github.com)

On further researching, I see you work on Prosemirror and have fielded issues around this before. I can build up a proper sandbox and file an issue there if that's better (and I actually have a bug and not a misunderstanding/misuse). Cheers

On further researching, I see you work on Prosemirror and have fielded issues around this before. I can build up a proper sandbox and file an issue there if that's better (and I actually have a bug and not a misunderstanding/misuse). Cheers
marijnh commented 2023-06-07 09:47:37 +02:00 (Migrated from github.com)

On macOS, if you hold down Shift and Cmd, event.key will hold the base name of the key that was pressed, rather than the Shift-modified character. It used to be a bunch worse than that—it also behaved that way when Ctrl was held down, and would even report key names for the physical keys instead of the chosen keyboard layout, but this issue prompted me to do some testing again and I found that most of this is fixed. I guess they have to keep the Cmd+Shift behavior for backwards compatibility. Attached patch narrows down the situations in which this hack (ignore key in favor of keyCode) is applied, which might address the issue you were seeing.

On macOS, if you hold down Shift and Cmd, `event.key` will hold the base name of the key that was pressed, rather than the Shift-modified character. It used to be a bunch worse than that—it also behaved that way when Ctrl was held down, and would even report `key` names for the physical keys instead of the chosen keyboard layout, but this issue prompted me to do some testing again and I found that most of this is fixed. I guess they have to keep the Cmd+Shift behavior for backwards compatibility. Attached patch narrows down the situations in which this hack (ignore `key` in favor of `keyCode`) is applied, which might address the issue you were seeing.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marijn/w3c-keyname#16
No description provided.