(NodeJS) Keyboard shortcuts doesn't work(using dynamic event → Keyboard Down)

======== TEMPLATE BUG FORM ========

Wappler Version : 3.5.7
Operating System : W10
Server Model: Node
Database Type:mysql
Hosting Type: docker/local

Expected behavior

What do you think should happen?

A browser alert should trigger when setting up a Dynamic Event on Key Down in the app settings:


Actual behavior

What actually happens?

Nothing happens when pressing the key combination

How to reproduce

  1. Create NodeJS project
  2. Set up a layout page
  3. Set up a content page
  4. Create browser component on layout page
  5. On the content page to to the app settings, set a dynamic event on key down for the key F
  6. At action set it to do a browser alert with the text “F is pressed”
  7. Save, open browser and press F
  8. The alert doesn’t show

Possibly related… Nodejs content page keyboard shortcuts breaks sidebar view of app

Hello,
you cannot assign dynamic events on App like that on the content pages. The options should not be available in the UI anyway, so we will remove them from there.

Ah okay, thanks @Teodor

Then, where can I set up the trigger on keyboard pressed?

Just want to trigger a modal when a shortcut is pressed on a content page

@Teodor I’m probably doing it wrong… I’m trying to replicate this Using Shortcut Keys for Dynamic Events

I tried adding the event to another element (the modal itself or a div):

But it never triggers when I press the key.
I’ve tried:

  • Different keys (both singular or combinations)
  • Different actions (browser alert, show modal)
  • Added the dynamic event to different elements (a simply div, the modal itself, a container)

Thank you for the help!

Small bump, anyone knows how to get it working?

You can’t just add a keyboard event to any element. You need to make it “selectable” first by adding tabindex to it.

See

1 Like