Fixes #1856.
Unified · Split
| @@ -12,6 +12,7 @@ class app.Settings · 11 unmodified lines | ||
| 12 | 12 | 'layout' |
| 13 | 13 | 'size' |
| 14 | 14 | 'tips' |
| 15 | + 'noAutofocus' | |
| 15 | 16 | 'autoInstall' |
| 16 | 17 | 'spaceScroll' |
| 17 | 18 | 'spaceTimeout' |
| @@ -34,6 +34,9 @@ app.templates.settingsPage = (settings) -> """ · 33 unmodified lines | ||
| 34 | 34 | <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar |
| 35 | 35 | <small>Tip: drag the edge of the sidebar to resize it.</small> |
| 36 | 36 | </label> |
| 37 | + <label class="_settings-label _hide-on-mobile"> | |
| 38 | + <input type="checkbox" form="settings" name="noAutofocus" value="_no-autofocus"#{if settings.noAutofocus then ' checked' else ''}>Disable autofocus of search input | |
| 39 | + </label> | |
| 37 | 40 | <label class="_settings-label"> |
| 38 | 41 | <input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use |
| 39 | 42 | <small>Only enable this when bandwidth isn't a concern to you.</small> |
| @@ -14,6 +14,7 @@ class app.views.SettingsPage extends app.View · 13 unmodified lines | ||
| 14 | 14 | settings.theme = app.settings.get('theme') |
| 15 | 15 | settings.smoothScroll = !app.settings.get('fastScroll') |
| 16 | 16 | settings.arrowScroll = app.settings.get('arrowScroll') |
| 17 | + settings.noAutofocus = app.settings.get('noAutofocus') | |
| 17 | 18 | settings.autoInstall = app.settings.get('autoInstall') |
| 18 | 19 | settings.analyticsConsent = app.settings.get('analyticsConsent') |
| 19 | 20 | settings.spaceScroll = app.settings.get('spaceScroll') |
| @@ -39,12 +39,16 @@ class app.views.Search extends app.View · 38 unmodified lines | ||
| 39 | 39 | return |
| 40 | 40 | |
| 41 | 41 | focus: => |
| 42 | − @input.focus() unless document.activeElement is @input | |
| 42 | + return if document.activeElement is @input | |
| 43 | + return if app.settings.get('noAutofocus') | |
| 44 | + @input.focus() | |
| 43 | 45 | return |
| 44 | 46 | |
| 45 | 47 | autoFocus: => |
| 46 | − unless app.isMobile() or $.isAndroid() or $.isIOS() | |
| 47 | − @input.focus() unless document.activeElement?.tagName is 'INPUT' | |
| 48 | + return if app.isMobile() or $.isAndroid() or $.isIOS() | |
| 49 | + return if document.activeElement?.tagName is 'INPUT' | |
| 50 | + return if app.settings.get('noAutofocus') | |
| 51 | + @input.focus() | |
| 48 | 52 | return |
| 49 | 53 | |
| 50 | 54 | onWindowFocus: (event) => |