1
I would like to make an accessible menu, can be retracted with Esc and navigable by tab, what would be the best way to do? by keyup, keydown, someone would have a good example to mention?
1
I would like to make an accessible menu, can be retracted with Esc and navigable by tab, what would be the best way to do? by keyup, keydown, someone would have a good example to mention?
1
The best way for you to do this is to map the keys you will use, because each key has its numbering.
In your case capture the pressed key, set which DOM element you want to work, ie you will receive the keyboard event and apply the code you want after validation of the key.
You can use the jQuery library’s Keypress event, see the example of how to detect the command on the full page, anywhere the cursor is:
$(document).ready(function(){
$(document).keypress(function(e){
//Enter
if(e.wich == 13 || e.keyCode == 13){
//Botão responsável por exibir a lista do menu;
}
// Esc
if(e.wich == 27 || e.keyCode == 27){
//Botão responsável por esconder a lista do menu;
}
})
});
You can do it using Javascript or Jquery:
very well explained, thank you.
Browser other questions tagged jquery accessibility
You are not signed in. Login or sign up in order to post.
Some time ago I created that "library" for similar purposes
– Guilherme Lautert