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

refactor: Replace keycode dependency with event.key #8735

Merged
merged 3 commits into from
May 23, 2024

Conversation

mister-ben
Copy link
Contributor

Description

Removes the keycode dependency. That relies on now deprecated event properties. KeyboardEvent.key is now ubiquitous, so can be used directly instead.

Reduces min.js slightly, 646.9 kB => 645.22 kB

The uses of deprecated keyCode in utils/spatial-navigation-keycode.js ought to be reviewed too.

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chrome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
  • Reviewed by Two Core Contributors

Copy link

codecov bot commented May 17, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 83.00%. Comparing base (978731e) to head (986a8bd).
Report is 1 commits behind head on main.

Files Patch % Lines
src/js/control-bar/progress-control/seek-bar.js 0.00% 7 Missing ⚠️
src/js/menu/menu-button.js 0.00% 6 Missing ⚠️
src/js/slider/slider.js 0.00% 6 Missing ⚠️
src/js/control-bar/volume-panel.js 0.00% 2 Missing ⚠️
src/js/menu/menu.js 0.00% 2 Missing ⚠️
src/js/menu/menu-item.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8735      +/-   ##
==========================================
- Coverage   83.15%   83.00%   -0.15%     
==========================================
  Files         120      119       -1     
  Lines        7995     7991       -4     
  Branches     1924     1921       -3     
==========================================
- Hits         6648     6633      -15     
- Misses       1347     1358      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/js/menu/menu-item.js Show resolved Hide resolved
@mister-ben mister-ben merged commit 35de64c into videojs:main May 23, 2024
9 checks passed
@@ -298,19 +297,19 @@ class MenuButton extends Component {
handleKeyDown(event) {

// Escape or Tab unpress the 'button'
if (keycode.isEventKey(event, 'Esc') || keycode.isEventKey(event, 'Tab')) {
if (event.key === 'Esc' || event.key === 'Tab') {
Copy link
Member

Choose a reason for hiding this comment

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

looks like during review, we missed that these should be Escape rather than Esc, which keycode likely helped with. Someone noticed this issue in slack.

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.

2 participants