FIX: more consistent filter from keyboard on select-box

This commit is contained in:
Joffrey JAFFEUX 2017-08-25 01:48:32 +02:00 committed by GitHub
parent 8a06d3d312
commit bbd428fb94
3 changed files with 18 additions and 2 deletions

View File

@ -78,6 +78,10 @@ export default Ember.Component.extend({
this.set("content", []);
}
if (this.site.isMobileDevice) {
this.set("filterable", false);
}
this.setProperties({
componentId: this.elementId,
filteredContent: []
@ -193,6 +197,13 @@ export default Ember.Component.extend({
this.$(".select-box-offscreen").blur();
return false;
}
if (keyCode >= 65 && keyCode <= 90) {
this.setProperties({expanded: true, focused: false});
Ember.run.schedule("afterRender", () => {
this.$(".filter-query").focus().val(String.fromCharCode(keyCode));
});
}
});
this.$(".select-box-offscreen").on("focusout.select-box", () => {
@ -259,6 +270,7 @@ export default Ember.Component.extend({
_bindTab() {
$(document).on("keydown.select-box", (event) => {
const keyCode = event.keyCode || event.which;
if (keyCode === 9) {
this.set("expanded", false);
}

View File

@ -3,6 +3,10 @@
class="filter-query"
placeholder=filterPlaceholder
key-up=onFilterChange
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck=false
}}
{{#if filterIcon}}

View File

@ -2,7 +2,7 @@
<label class="control-label">{{i18n 'user.email_settings'}}</label>
<div class='controls controls-dropdown'>
<label>{{i18n 'user.email_previous_replies.title'}}</label>
{{combo-box valueAttribute="value" content=previousRepliesOptions value=model.user_option.email_previous_replies}}
{{select-box idKey="value" textKey="name" content=previousRepliesOptions value=model.user_option.email_previous_replies}}
</div>
{{preference-checkbox labelKey="user.email_in_reply_to" checked=model.user_option.email_in_reply_to}}
{{preference-checkbox labelKey="user.email_private_messages" checked=model.user_option.email_private_messages}}
@ -25,7 +25,7 @@
{{preference-checkbox labelKey="user.email_digests.title" disabled=model.user_option.mailing_list_mode checked=model.user_option.email_digests}}
{{#if model.user_option.email_digests}}
<div class='controls controls-dropdown'>
{{combo-box valueAttribute="value" content=digestFrequencies value=model.user_option.digest_after_minutes}}
{{select-box idKey="value" filterable=true textKey="name" content=digestFrequencies value=model.user_option.digest_after_minutes}}
</div>
{{preference-checkbox labelKey="user.include_tl0_in_digests" disabled=model.user_option.mailing_list_mode checked=model.user_option.include_tl0_in_digests}}
{{/if}}