I'm using the following function with knockout
self.navigateToSection = ko.pureComputed({
read: function() {
return this;
},
write: function(data, event) {
if (event.type == "keydown") {
if ((event.keyCode != '13')) {
return;
}
}
... (more actions)
}//write
});
this is the HTML binding
data-bind="event: {keypress: navigateToSection}">
The function should help to navigate between different sections so the user must to be able to press the tab key and jump to a different link. it works well for most of the browser except for firefox in Windows 10 it's working fine in Mac for Firefox
I found that keypress event is no longer fired for non-printable keys, except for the Enter key, and the Shift + Enter and Ctrl + Enter key combinations for Firefox. So when I press tab it seems stock there instead to jump to the next HTML element with a tabindex attribute if I blur the element it allows to jump even in FF but just until the second keypress.
I try to unbind the element but it does not work well. Any ideas?
The
keypressevent has been deprecated. You should usekeydowninstead.