From d4f3f894f4de0522c19cd1bcd34dd91d972d1e97 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 21 Oct 2014 08:12:29 +1100 Subject: [PATCH] FEATURE: focus input on modals is optional --- app/assets/javascripts/discourse/views/modal_body_view.js | 3 ++- app/assets/javascripts/discourse/views/search-help.js.es6 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/views/modal_body_view.js b/app/assets/javascripts/discourse/views/modal_body_view.js index f161045cbe3..10eec8f6cd4 100644 --- a/app/assets/javascripts/discourse/views/modal_body_view.js +++ b/app/assets/javascripts/discourse/views/modal_body_view.js @@ -7,6 +7,7 @@ @module Discourse **/ Discourse.ModalBodyView = Discourse.View.extend({ + focusInput: true, _setupModal: function() { var self = this, @@ -20,7 +21,7 @@ Discourse.ModalBodyView = Discourse.View.extend({ $('#modal-alert').hide(); // Focus on first element - if (!Discourse.Mobile.mobileView) { + if (!Discourse.Mobile.mobileView && self.get('focusInput')) { Em.run.schedule('afterRender', function() { self.$('input:first').focus(); }); diff --git a/app/assets/javascripts/discourse/views/search-help.js.es6 b/app/assets/javascripts/discourse/views/search-help.js.es6 index 4492fde70a9..888c48bb4d9 100644 --- a/app/assets/javascripts/discourse/views/search-help.js.es6 +++ b/app/assets/javascripts/discourse/views/search-help.js.es6 @@ -1,4 +1,5 @@ export default Discourse.ModalBodyView.extend({ templateName: 'modal/search_help', - title: I18n.t('search_help.title') + title: I18n.t('search_help.title'), + focusInput: false });