[DE PE SSE] Fix ability to navigate through search results by enter key
This commit is contained in:
parent
e35f9f70b2
commit
e27d11189e
|
@ -198,13 +198,15 @@ define([
|
|||
var elFocus = this.getChild().find(':focus'),
|
||||
action = elFocus.prop('id') === 'search-bar-next' ? 'next' : 'back';
|
||||
elFocus.find('button')[e.keyCode === Common.UI.Keys.RETURN ? 'addClass' : 'removeClass']('focused');
|
||||
this.fireEvent('search:keydown-next', [action, this.inputSearch.val(), e]);
|
||||
if (e.keyCode !== Common.UI.Keys.RETURN) {
|
||||
if (e.keyCode === Common.UI.Keys.RETURN) {
|
||||
this.fireEvent('search:keydown-next', [action, this.inputSearch.val(), e]);
|
||||
} else {
|
||||
this.onMousedown();
|
||||
}
|
||||
},
|
||||
|
||||
onMousedown: function () {
|
||||
this.fireEvent('search:enable-key');
|
||||
this.getChild().find('.focused').removeClass('focused');
|
||||
$(document).off('keydown', this.wrapEvents.keydown);
|
||||
$(document).off('mousedown', this.wrapEvents.mousedown);
|
||||
|
|
|
@ -369,13 +369,15 @@ define([
|
|||
var elFocus = $(':focus'),
|
||||
action = elFocus.prop('id') === 'search-adv-next' ? 'next' : 'back';
|
||||
elFocus.find('button')[e.keyCode === Common.UI.Keys.RETURN ? 'addClass' : 'removeClass']('focused');
|
||||
this.fireEvent('search:keydown-next', [action, this.inputText.getValue(), e]);
|
||||
if (e.keyCode !== Common.UI.Keys.RETURN) {
|
||||
if (e.keyCode === Common.UI.Keys.RETURN) {
|
||||
this.fireEvent('search:keydown-next', [action, this.inputText.getValue(), e]);
|
||||
} else {
|
||||
this.onMousedown();
|
||||
}
|
||||
},
|
||||
|
||||
onMousedown: function () {
|
||||
this.fireEvent('search:enable-key');
|
||||
this.$el.find('.focused').removeClass('focused');
|
||||
$(document).off('keydown', this.wrapEvents.keydown);
|
||||
$(document).off('mousedown', this.wrapEvents.mousedown);
|
||||
|
|
|
@ -67,7 +67,8 @@ define([
|
|||
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
|
||||
'show': _.bind(this.onSelectSearchingResults, this, true),
|
||||
'hide': _.bind(this.onSelectSearchingResults, this, false),
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this)
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this),
|
||||
'search:enable-key': _.bind(this.enableKeyEvents, this)
|
||||
},
|
||||
'Common.Views.SearchPanel': {
|
||||
'search:back': _.bind(this.onSearchNext, this, 'back'),
|
||||
|
@ -79,7 +80,8 @@ define([
|
|||
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
|
||||
'show': _.bind(this.onShowPanel, this),
|
||||
'hide': _.bind(this.onHidePanel, this),
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this)
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this),
|
||||
'search:enable-key': _.bind(this.enableKeyEvents, this)
|
||||
},
|
||||
'LeftMenu': {
|
||||
'search:aftershow': _.bind(this.onShowAfterSearch, this)
|
||||
|
@ -164,7 +166,11 @@ define([
|
|||
},
|
||||
|
||||
onKeydownNext: function (type, text, e) {
|
||||
e.keyCode === Common.UI.Keys.RETURN ? this.onSearchNext(type, text, e) : this.api.asc_enableKeyEvents(true);
|
||||
this.onSearchNext(type, text, e);
|
||||
},
|
||||
|
||||
enableKeyEvents: function () {
|
||||
this.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
onInputSearchChange: function (text) {
|
||||
|
|
|
@ -65,7 +65,8 @@ define([
|
|||
this.onInputSearchChange(text);
|
||||
}, this),
|
||||
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this)
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this),
|
||||
'search:enable-key': _.bind(this.enableKeyEvents, this)
|
||||
},
|
||||
'Common.Views.SearchPanel': {
|
||||
'search:back': _.bind(this.onSearchNext, this, 'back'),
|
||||
|
@ -77,7 +78,8 @@ define([
|
|||
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
|
||||
'show': _.bind(this.onShowPanel, this),
|
||||
'hide': _.bind(this.onHidePanel, this),
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this)
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this),
|
||||
'search:enable-key': _.bind(this.enableKeyEvents, this)
|
||||
},
|
||||
'LeftMenu': {
|
||||
'search:aftershow': _.bind(this.onShowAfterSearch, this)
|
||||
|
@ -161,7 +163,11 @@ define([
|
|||
},
|
||||
|
||||
onKeydownNext: function (type, text, e) {
|
||||
e.keyCode === Common.UI.Keys.RETURN ? this.onSearchNext(type, text, e) : this.api.asc_enableKeyEvents(true);
|
||||
this.onSearchNext(type, text, e);
|
||||
},
|
||||
|
||||
enableKeyEvents: function () {
|
||||
this.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
onInputSearchChange: function (text) {
|
||||
|
|
|
@ -61,7 +61,8 @@ define([
|
|||
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
|
||||
'show': _.bind(this.onSelectSearchingResults, this, true),
|
||||
'hide': _.bind(this.onSelectSearchingResults, this, false),
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this)
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this),
|
||||
'search:enable-key': _.bind(this.enableKeyEvents, this)
|
||||
},
|
||||
'Common.Views.SearchPanel': {
|
||||
'search:back': _.bind(this.onSearchNext, this, 'back'),
|
||||
|
@ -73,7 +74,8 @@ define([
|
|||
'search:keydown': _.bind(this.onSearchNext, this, 'keydown'),
|
||||
'show': _.bind(this.onShowPanel, this),
|
||||
'hide': _.bind(this.onHidePanel, this),
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this)
|
||||
'search:keydown-next': _.bind(this.onKeydownNext, this),
|
||||
'search:enable-key': _.bind(this.enableKeyEvents, this)
|
||||
},
|
||||
'LeftMenu': { // TO DO
|
||||
'search:aftershow': _.bind(this.onShowAfterSearch, this)
|
||||
|
@ -218,7 +220,11 @@ define([
|
|||
},
|
||||
|
||||
onKeydownNext: function (type, text, e) {
|
||||
e.keyCode === Common.UI.Keys.RETURN ? this.onSearchNext(type, text, e) : this.api.asc_enableKeyEvents(true);
|
||||
this.onSearchNext(type, text, e);
|
||||
},
|
||||
|
||||
enableKeyEvents: function () {
|
||||
this.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
|
||||
onInputSearchChange: function (text) {
|
||||
|
|
Loading…
Reference in a new issue