-
Notifications
You must be signed in to change notification settings - Fork 95
feat: add NcKbd component #7401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Escape: !mac | ||
| ? t('Escape') // TRANSLATORS: Escape key on keyboard | ||
| : '⎋', | ||
| Space: t('Space'), // TRANSLATORS: Space key on keyboard |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we sometimes use icons for them, maybe use this for space?
https://pictogrammers.com/library/mdi/icon/keyboard-space/
its quite common, no? cc @nextcloud-libraries/designers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We never use icons (images). It was discussed with @kra-mo that symbols look fine on macOS.
Same for the space — even though there is a symbol, it was decided to use a word here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely would put it for mac, otherwise it stands out too much.
Also might be less confusion for translators. That's usually the only button that doesn't have a text on a physical keyboard, and also the one i would translate out of all other
UPD: maybe this? ␣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it will look silly translated like in German I rarely see this like
[Strg] + [Leertaste]
I would expect the icon for the space key as it does not has any label on the keyboard.
But also for the other icons you added for Mac, are you sure they work for screen readers? If not maybe just use icons and add aria label with the real name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test these symbols specifically, but usually it works well with screen readers.
I'd prefer to use symbols to safe from translating it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also add a comment for translator to translate it only if it is a common practice.
E.g., CTRL almost never translated in Russian.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case, I think the word Space is still more well-recognized internationally than the ␣ symbol, but I might be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least everything is better than the firefox and thunderbird shortcuts help which uses really silly names...
If you both did not see the symbol that often then its probably fine, it just stands out quite visible for MacOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it just stands out quite visible for MacOS
I do agree that it does, but for macOS specifically, it's just about following platform conventions
susnux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space as icon or as text is a @nextcloud-libraries/designers decision, while I rarely saw a label used (especially translated) its probably ok.
So I let this up to the designers - code is fine!
Antreesy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise good
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
|
Rebased onto main, squashed |
|
If we decied to use an icon for the space, we can update it later without a breaking change. |
| /** | ||
| * Key name or symbol to display. | ||
| * For common special keys (CTRL, ALT, SHIFT, Arrow keys, etc.) it will display the symbol on macOS and the localized name on Windows/Linux. | ||
| */ | ||
| symbol?: 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight' | 'Control' | 'Alt' | 'Shift' | 'Enter' | 'Space' | 'Tab' | 'Delete' | 'Escape' | (string & {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case before merging.
@susnux Are you fine with this prop name?
(key cannot be used as it is a special attribute).
Alternative: keyname, keycode (but it has a different meaning in web api), code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you also write "Key name" as the doc I think keyname is pretty good.
But also symbol seems to fit here so you can merged if you like ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But proper name would be keyName which would be <NcKbd key-name="..." /> maybe stick with symbol instead 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Antreesy Do I remember it correctly, that in useHotKey the preferred way to set a key is the keyCode (like KeyF, not F)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No it takes F and then checks if key is equal (e.g. F === F) otherwise falls back to get the keyCode and removes the Key or Digit and then compares
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just F would be preferable, as we can then derive the keyCode from it
|
/backport to stable1 |
|
The backport to # Switch to the target branch and update it
git checkout stable1
git pull origin stable1
# Create the new backport branch
git checkout -b backport/7401/stable1
# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick deaebab5 0e596d41
# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/7401/stable1Error: Failed to clone repository: Failed to create working tree: Preparing worktree (new branch 'backport/7401/stable1') Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports. |
Quite old branch ;) |
|
/backport to stable8 |
I'm tired 😴 |

☑️ Resolves
<kbd>Note: complete form will have an additional component for an entire keyboard shortcut list
🖼️ Screenshots
Windows
macOS
🏁 Checklist
stable8for maintained Vue 2 version or not applicable