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

[4.5.1^]: JavasScript console errors in CP pages on any keypress #13605

Closed
gustavs-gutmanis opened this issue Aug 25, 2023 · 3 comments
Closed

Comments

@gustavs-gutmanis
Copy link
Contributor

What happened?

Description

Whenever I press any key at all (alphanumeric, modifier, esc, doesn't matter), I get a console error:

image

This seems to be happening in the UILayerManager.js file

// UILayerManager.js

triggerShortcut: function (ev, layerIndex) {
  if (typeof layerIndex === 'undefined') {
    layerIndex = this.layer;
  }
  const layer = this.layers[layerIndex];
  const shortcut = layer.shortcuts.find(
    (s) =>
      s.shortcut.keyCode === ev.keyCode &&
      s.shortcut.ctrl === Garnish.isCtrlKeyPressed(ev) &&
      s.shortcut.shift === ev.shiftKey &&
      s.shortcut.alt === ev.altKey
  );

  if (shortcut) {
    ev.preventDefault();
    shortcut.callback(ev);

  // <-- `.bubble` is causing the error
  } else if (layer.options.bubble && layerIndex > 0) {
    this.triggerShortcut(ev, layerIndex - 1);
  }
},

Steps to reproduce

  1. Open the Craft CMS CP panel (any page)
  2. Open dev-tools
  3. Press any key
  4. See the error in the console

Expected behavior

There should be no errors when pressing keys.

Actual behavior

There are errors when pressing keys.

Craft CMS version

4.5.1

PHP version

8.1.13

Operating system and version

MacOS 13.4.1

Database type and version

MySQL 5.7.39

Image driver and version

GD 2.1.0

Installed plugins and versions

  • No plugins
@brandonkelly
Copy link
Member

Thanks for reporting that! Fixed for the next release.

@brandonkelly
Copy link
Member

Craft 4.5.3 is out now with a fix for this. Thanks again!

@gustavs-gutmanis
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants