ai / keyux

JS library to improve keyboard UI of web apps
https://ai.github.io/keyux/
MIT License
391 stars 18 forks source link

format mac hints according to guidelines #5

Closed myandrienko closed 6 months ago

myandrienko commented 6 months ago

MacOS has specific guidelines regarding how hotkey shortcuts should be represented. Most importantly, they should be listed in a specific order (Ctrl, Alt, Shift, Meta), and the plus sign is not used a delimiter:

image

This PR implements those recommendations.

ai commented 6 months ago

You will need to update package→size-limit (and maybe try some experiments to make size a little smaller. 40 bytes is too much for simple change.

myandrienko commented 6 months ago

You will need to update package→size-limit (and maybe try some experiments to make size a little smaller. 40 bytes is too much for simple change.

Tried a new approach (regex instead of sort) and actually managed to reduce the bundle size by 4B.

ai commented 6 months ago

Last things to do:

  1. Resolve conflict.
  2. Think about using short space for Mac
  3. Fix modifier order for Windows too 😈
myandrienko commented 6 months ago

3. Fix modifier order for Windows too 😈

@ai For Windows, the modifier order is Meta (Win), Ctrl, Alt, Shift. Would you be OK with this as the canonical order of modifiers for aria-keyshortcuts, or is too much of a breaking change?

ai commented 6 months ago

For Windows, the modifier order is Meta (Win), Ctrl, Alt, Shift. Would you be OK with this as the canonical order of modifiers for aria-keyshortcuts, or is too much of a breaking change?

Yes, we just need to check that hotkeys.js expect the modifiers in that canonical order.

We don’t need to change this helper function, just change docs if needed.

myandrienko commented 6 months ago

@ai All right, some changes are required in hotkey.js to make Meta (Win), Ctrl, Alt, Shift the canonical order - let's do it in a separate PR :)

ai commented 6 months ago

All right, some changes are required in hotkey.js to make Meta (Win), Ctrl, Alt, Shift the canonical order - let's do it in a separate PR :)

Agree.

In this case only two steps.

ai commented 6 months ago

Thanks. Released in 0.3.