Skip to content
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

feat(NcAppNavigation): add n hotkey to toggle navigation #6311

Merged
merged 3 commits into from
Dec 20, 2024

Conversation

skjnldsv
Copy link
Contributor

@skjnldsv skjnldsv self-assigned this Dec 19, 2024
@skjnldsv skjnldsv added 3. to review Waiting for reviews feature: app-navigation Related to the app-navigation component accessibility Making sure we design for the widest range of people possible, including those who have disabilities labels Dec 19, 2024
@skjnldsv skjnldsv added this to the 8.22.0 milestone Dec 19, 2024
@skjnldsv
Copy link
Contributor Author

/backport to next

Copy link
Contributor

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Copy link
Contributor

@ShGKme ShGKme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Could you also add aria-keyshortcuts to the toggle button for accessibility as well as something like [n] to the button's title (tooltip)? So users can find the shortcut.

Should we also close navigation by n?

src/components/NcAppNavigation/NcAppNavigation.vue Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@skjnldsv
Copy link
Contributor Author

Could you also add aria-keyshortcuts to the toggle button for accessibility

Sure :)

Should we also close navigation by n?

We could do escape instead, assuming if we're in focus within the navigation 🤔

@skjnldsv skjnldsv force-pushed the feat/navigation-hotkey branch from 357e99c to 8d2349d Compare December 19, 2024 10:32
@skjnldsv skjnldsv requested a review from ShGKme December 19, 2024 10:32
@skjnldsv
Copy link
Contributor Author

Done @ShGKme
Also added cypress tests

@skjnldsv skjnldsv force-pushed the feat/navigation-hotkey branch from 8d2349d to 7a3af7a Compare December 19, 2024 10:34
@ShGKme

This comment was marked as resolved.

@skjnldsv

This comment was marked as resolved.

@skjnldsv skjnldsv force-pushed the feat/navigation-hotkey branch from 7a3af7a to fab334a Compare December 19, 2024 10:46
@skjnldsv
Copy link
Contributor Author

Done @ShGKme

return this.open ? t('Close navigation') : t('Open navigation')
return this.open
? t('Close navigation')
: t('Open navigation {shortcut}', { shortcut: disableKeyboardShortcuts ? '' : '[n]' })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To not change strings. It doesn't change the string meaning, no translation is required.

Suggested change
: t('Open navigation {shortcut}', { shortcut: disableKeyboardShortcuts ? '' : '[n]' })
: t('Open navigation') + (disableKeyboardShortcuts ? '' : ' [n]')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it's not compatible with rtl languages then :)

Copy link
Contributor

@ShGKme ShGKme Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yes, because n is inherently LTR and not neutral like [], - or numbers, it is kept on the right on RTL.

But I'd still not add a new translation string for something that is not a text but a technical concatenation.

What about adding a utility to @nextcloud/l10n to concatenate strings taking RTL into account? So we never need to ask many translators to translate such things.

@ShGKme

This comment was marked as resolved.

@skjnldsv

This comment was marked as resolved.

@ShGKme

This comment was marked as resolved.

@skjnldsv

This comment was marked as resolved.

@skjnldsv skjnldsv force-pushed the feat/navigation-hotkey branch from 0ed33e1 to 9c685e9 Compare December 19, 2024 14:06
@skjnldsv
Copy link
Contributor Author

Done @ShGKme

  • if closed, pressing n will open it
  • if opened AND focus within, pressing n will close it
  • if opened and focus NOT within, pressing n will do nothing

@skjnldsv skjnldsv requested a review from ShGKme December 19, 2024 14:07
@skjnldsv skjnldsv enabled auto-merge December 19, 2024 14:10
@skjnldsv skjnldsv merged commit b804306 into master Dec 20, 2024
19 checks passed
@skjnldsv skjnldsv deleted the feat/navigation-hotkey branch December 20, 2024 13:15
@ShGKme
Copy link
Contributor

ShGKme commented Dec 20, 2024

So there is no way to close navigation with a hotkey without putting the focus on the navigation first?

@hamza221 hamza221 mentioned this pull request Dec 20, 2024
@skjnldsv
Copy link
Contributor Author

So there is no way to close navigation with a hotkey without putting the focus on the navigation first?

I think that would lead to issues otherwise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews accessibility Making sure we design for the widest range of people possible, including those who have disabilities feature: app-navigation Related to the app-navigation component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants