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

Add keyboard shortcuts to titles #5857

Merged

Conversation

kommunarr
Copy link
Collaborator

@kommunarr kommunarr commented Oct 13, 2024

Add keyboard shortcuts to titles

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

closes #1587

Description

  • Adds keyboard shortcut information to their button labels, e.g., Mute (m)
    • This includes the video player buttons, the feed refresh buttons, the side nav History/Settings titles, and the top nav HistoryForward/HistoryBackward/OpenNewWindow buttons, but NOT Electron context menu labels
  • Implementation note: To do this properly for the built-in Shaka controls that we don't modify in our code, this PR updates the base Shaka label localization values to include the shortcut whenever the Shaka locale is set.
  • Implementation note: Constants were added for the aforementioned keyboard shortcuts.

Screenshots

Screenshot_20241013_181816

Testing

  • Test that buttons with corresponding keyboard shortcuts have the shortcut referenced in the label, be they in "on" or "off" mode (e.g., Full screen (f) / Exit full screen (f)). See the official list of shortcuts for reference.

Desktop

  • OS: OpenSUSE
  • OS Version: TW

Additional context

The addition of the new constants should help make enhancements like #251 easier in the future.

@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Oct 13, 2024
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) October 13, 2024 23:32
src/constants.js Outdated Show resolved Hide resolved
src/constants.js Outdated Show resolved Hide resolved
@kommunarr kommunarr requested a review from PikachuEXE October 14, 2024 02:35
@PikachuEXE
Copy link
Collaborator

Label for captions
image
image

@kommunarr
Copy link
Collaborator Author

kommunarr commented Oct 14, 2024

Another good catch; I wasn't testing with a video that had a captions option. Just fixed the issue and added logic preventing label modification if the Shaka localization key does not exist. Also note that this specific Captions label will be the only one with another parenthetical present. This is fine IMO.

Screenshot_20241014_080659

@kommunarr kommunarr force-pushed the feat/add-shortcut-labels branch from ad59178 to 6202ff7 Compare October 14, 2024 13:25
@kommunarr kommunarr force-pushed the feat/add-shortcut-labels branch from 6202ff7 to 7c379e2 Compare October 14, 2024 13:26
src/constants.js Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Pressing c doesnt enable/disable captions

@kommunarr
Copy link
Collaborator Author

kommunarr commented Oct 14, 2024

Added localization of shortcuts & multi-key shortcuts and caught a dangling instance of the wrong constant name for CAPTIONS

@efb4f5ff-1298-471a-8973-3d47447115dc
Copy link
Member

efb4f5ff-1298-471a-8973-3d47447115dc commented Oct 14, 2024

Question: Navigating to the History tab and Settings tab also got shortcuts. Is there a reason those weren't added?

@kommunarr
Copy link
Collaborator Author

@efb4f5ff-1298-471a-8973-3d47447115dc I specifically added the shortcuts with corresponding button labels. The closest equivalent to those would be the corresponding side nav options, which I suppose would work. I can add those as well.

@kommunarr kommunarr force-pushed the feat/add-shortcut-labels branch from b934703 to 6f8d212 Compare October 14, 2024 19:35
PikachuEXE
PikachuEXE previously approved these changes Oct 15, 2024
Copy link
Collaborator

@PikachuEXE PikachuEXE left a comment

Choose a reason for hiding this comment

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

Tested video player, sidebar, top nav button labels, refresh button

Only on MacOS though

Copy link
Contributor

github-actions bot commented Nov 2, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@efb4f5ff-1298-471a-8973-3d47447115dc

Just fixing full window to have the shortcut show in the overflow menu?

correct

Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@kommunarr kommunarr force-pushed the feat/add-shortcut-labels branch from 8410df1 to 304fa82 Compare November 24, 2024 01:03
PikachuEXE
PikachuEXE previously approved these changes Nov 24, 2024
@kommunarr kommunarr force-pushed the feat/add-shortcut-labels branch from cb7f395 to 532fcc7 Compare November 26, 2024 22:13
@ChunkyProgrammer ChunkyProgrammer added the PR: waiting for review For PRs that are complete, tested, and ready for review label Nov 27, 2024
@FreeTubeBot FreeTubeBot merged commit 112fd32 into FreeTubeApp:development Dec 2, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Dec 2, 2024
Soham456 pushed a commit to Soham456/FreeTube that referenced this pull request Dec 5, 2024
* Update title for custom FreeTube button labels with keyboard shortcuts

* Add keyboard shortcut to unmodified Shaka control labels

* Replace in-code use of available shortcuts with the corresponding constants

* Add explanatory comments

* Fix captions constant name

* Prevent creating new shortcut localization if Shaka localization key has no matching value

* Add util functions to localize special keys

* Replace more video player shortcut usage in code with corresponding constants

* Add labels for History and Settings app shortcuts, and update variable naming

* Display 'Option' instead of 'Alt' for Mac users

* Use Mac icons in keyboard shortcuts for Macs

* Update Mac arrow icon choice

* Update KeyboardShortcuts constant organization in preparation for keyboard shorcut modal

* Adjust nameSpan._textContent to be set to same value as aria-label

* Add code comment explaining shakaControlKeysToShortcuts

* Move changes from deleted Popular.js to Popular.vue
jlvivero pushed a commit to jlvivero/FreeTube that referenced this pull request Dec 7, 2024
* Update title for custom FreeTube button labels with keyboard shortcuts

* Add keyboard shortcut to unmodified Shaka control labels

* Replace in-code use of available shortcuts with the corresponding constants

* Add explanatory comments

* Fix captions constant name

* Prevent creating new shortcut localization if Shaka localization key has no matching value

* Add util functions to localize special keys

* Replace more video player shortcut usage in code with corresponding constants

* Add labels for History and Settings app shortcuts, and update variable naming

* Display 'Option' instead of 'Alt' for Mac users

* Use Mac icons in keyboard shortcuts for Macs

* Update Mac arrow icon choice

* Update KeyboardShortcuts constant organization in preparation for keyboard shorcut modal

* Adjust nameSpan._textContent to be set to same value as aria-label

* Add code comment explaining shakaControlKeysToShortcuts

* Move changes from deleted Popular.js to Popular.vue
SuperAKWA pushed a commit to SuperAKWA/FreeTube that referenced this pull request Jan 24, 2025
* Update title for custom FreeTube button labels with keyboard shortcuts

* Add keyboard shortcut to unmodified Shaka control labels

* Replace in-code use of available shortcuts with the corresponding constants

* Add explanatory comments

* Fix captions constant name

* Prevent creating new shortcut localization if Shaka localization key has no matching value

* Add util functions to localize special keys

* Replace more video player shortcut usage in code with corresponding constants

* Add labels for History and Settings app shortcuts, and update variable naming

* Display 'Option' instead of 'Alt' for Mac users

* Use Mac icons in keyboard shortcuts for Macs

* Update Mac arrow icon choice

* Update KeyboardShortcuts constant organization in preparation for keyboard shorcut modal

* Adjust nameSpan._textContent to be set to same value as aria-label

* Add code comment explaining shakaControlKeysToShortcuts

* Move changes from deleted Popular.js to Popular.vue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show on hover if icon has shortcut
6 participants