Dropdown menu keyboard navigation (step 1 / USTABLE)

This commit is contained in:
RainLoop Team 2014-04-11 20:09:51 +04:00
parent cd6974ecd2
commit 2ad305e40e
15 changed files with 305 additions and 228 deletions

View file

@ -37,6 +37,7 @@ Enums.KeyState = {
'MessageList': 'message-list',
'MessageView': 'message-view',
'Compose': 'compose',
'Menu': 'menu',
'PopupComposeOpenPGP': 'compose-open-pgp',
'PopupAsk': 'popup-ask'
};

View file

@ -126,6 +126,15 @@ ko.bindingHandlers.onEsc = {
}
};
ko.bindingHandlers.clickOnTrue = {
'update': function (oElement, fValueAccessor) {
if (ko.utils.unwrapObservable(fValueAccessor()))
{
$(oElement).click();
}
}
};
ko.bindingHandlers.modal = {
'init': function (oElement, fValueAccessor) {
$(oElement).toggleClass('fade', !Globals.bMobileDevice) .modal({

View file

@ -320,6 +320,7 @@ Selector.prototype.init = function (oContentVisible, oContentScrollable, sKeySco
})
;
// TODO
key('enter', sKeyScope, function () {
if (self.focusedItem())
{

View file

@ -39,6 +39,17 @@ function WebMailDataStorage()
this.projectHash = ko.observable('');
this.threading = ko.observable(false);
this.accountMenuFocus = ko.observable(false);
this.accountMenuFocus.sKeyState = Enums.KeyState.All;
this.accountMenuFocus.subscribe(function (bValue) {
if (bValue)
{
this.accountMenuFocus.sKeyState = RL.data().keyScope();
}
RL.data().keyScope(bValue ? Enums.KeyState.Menu : this.accountMenuFocus.sKeyState);
}, this);
this.lastFoldersHash = '';
this.remoteSuggestions = false;
@ -279,7 +290,7 @@ function WebMailDataStorage()
this.message.focused.subscribe(function (bValue) {
RL.data().keyScope(bValue ? Enums.KeyState.MessageView : Enums.KeyState.MessageList);
});
this.messageLoading.subscribe(function (bValue) {
this.messageLoadingThrottle(bValue);
}, this);

View file

@ -60,10 +60,10 @@
}
.e-item.selected > .e-link {
background-color: #eee;
background-color: #eee !important;
}
.e-item > .e-link:hover {
.e-item > .e-link:focus, .e-item > .e-link:hover {
background-color: #555;
background-image: none;
color: #fff;

View file

@ -13,6 +13,8 @@ function AbstractSystemDropDownViewModel()
this.accounts = oData.accounts;
this.accountEmail = oData.accountEmail;
this.accountsLoading = oData.accountsLoading;
this.accountMenuFocus = oData.accountMenuFocus;
this.allowAddAccount = RL.settingsGet('AllowAdditionalAccounts');
this.loading = ko.computed(function () {
@ -20,6 +22,14 @@ function AbstractSystemDropDownViewModel()
}, this);
this.accountClick = _.bind(this.accountClick, this);
key('`', function () {
if (oData.useKeyboardShortcuts() && !RL.popupVisibility() &&
!oData.accountMenuFocus())
{
oData.accountMenuFocus(true);
}
});
}
_.extend(AbstractSystemDropDownViewModel.prototype, KnoinAbstractViewModel.prototype);