Jump to content

Prevent default keyboard for a key and not for default


ftguy2018
 Share

Recommended Posts

Is there a way to prevent a key event to be forwarded to the browser ? In firefore backspace is reloading the page and the only way I could prevent this to happen is to set the attribute preventDefault to true however it will block all keys so I would like only to have the backspace key not to be forwarded because I am using it in my own inputfield, so is it a way to accomplish this ?

Thank you

Link to comment
Share on other sites

HI, show how do you use preventDefault.


I don't now how work 'Panda 2', but in JS i write something like that  

window.addEventListener(
    "keydown", (evt)=>
    {
       var keyCode = evt.keyCode; 
       if (keyCode != 0 && keyCode == 8) 
       {
            // your code is here
            evt.preventDefault();
       }
    }
);


I hope this helps you

Link to comment
Share on other sites

15 hours ago, Mobler said:

HI, show how do you use preventDefault.


I don't now how work 'Panda 2', but in JS i write something like that  


window.addEventListener(
    "keydown", (evt)=>
    {
       var keyCode = evt.keyCode; 
       if (keyCode != 0 && keyCode == 8) 
       {
            // your code is here
            evt.preventDefault();
       }
    }
);


I hope this helps you

I was using the config file with a keyboard section

 keyboard: {
      
      preventDefault: true  
    },

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...