Added keyboard shortcuts to top navigation

This commit is contained in:
Marcin Kurczewski
2014-09-29 22:17:32 +02:00
parent 51b3342d62
commit 6c76f016e7
4 changed files with 84 additions and 17 deletions

View File

@ -36,6 +36,7 @@ App.PresenterManager = function(jQuery, topNavigationPresenter, keyboard) {
if (lastContentPresenter === null || lastContentPresenter.name !== presenter.name) {
keyboard.reset();
topNavigationPresenter.changeTitle(null);
topNavigationPresenter.focus();
presenter.init.call(presenter, args, contentPresenterLoaded);
lastContentPresenter = presenter;
} else if (lastContentPresenter.reinit) {

View File

@ -47,6 +47,13 @@ App.Presenters.TopNavigationPresenter = function(
$el.find('li.' + selectedElement).find('a').addClass('active');
}
function focus() {
var $tmp = jQuery('<a href="#"> </a>');
$el.prepend($tmp);
$tmp.focus();
$tmp.remove();
}
function getBaseTitle() {
return baseTitle;
}
@ -63,6 +70,7 @@ App.Presenters.TopNavigationPresenter = function(
init: init,
render: render,
select: select,
focus: focus,
getBaseTitle: getBaseTitle,
changeTitle: changeTitle,
};