Event when pressing a button on the keyboard

  • 19 December 2022
  • 1 reply
  • 40 views

Badge +2

Hello!
Is it possible to assign an event to any button on the keyboard in Miro? I am trying to use the following code:

alert("1");

document.addEventListener('keydown', funсKey);

function funсKey() {
alert("2");
}

The first alert displays "1", but the second one does not work when you press the button on the keyboard. I tried to do this by replacing "keydown" with "click", but it didn't work either.


1 reply

Userlevel 6
Badge +4

Hey @Anton Shherbinin,

Thanks for reaching out about this!

At the moment, I don’t believe we have native support within the SDK itself for the keydown method. Have you considered leveraging the notifications method in our SDK for presenting alerts to end users? Maybe this could help:
https://developers.miro.com/docs/notifications_notifications 

Will

Reply