jQuery UI Tabs has this "feature" where if i press the up/left or down/right key arrows it switches the tabs and loads that tab.
Generally for horizontal tabs, users are more acquainted with having the up and down keys scroll the page vs moving tabs. Is it possible to disable tab navigation for only the up and down keys?
UPDATE
Based on Konstantin's suggestion i tried the following code. It blocks the event when I click the up or down key, right after clicking the anchor tab. If i hit another key though like the left/right keys and then hit the up/down keys again. It registers the event, but doesn't seem to stop propagation. Could the event be firing from another element? Here's my code:
$('#tabs').keydown(function (event) {
console.log("in tabs");
if (event.keyCode == 40 || event.keyCode == 38) {
event.stopPropagation();
event.preventDefault();
return false;
};
});
$('.ui-tabs-anchor').keydown(function (event) {
console.log("in ui tabs anchor");
if (event.keyCode == 40 || event.keyCode == 38) {
event.stopPropagation();
event.preventDefault();
return false;
};
});
$('.ui-tabs-nav').keydown(function (event) {
console.log("in ui tabs nav");
if (event.keyCode == 40 || event.keyCode == 38) {
event.stopPropagation();
event.preventDefault();
return false;
};
});