Let's be honest: we skip focus for iOS, not touch in general.

This commit is contained in:
Robin Ward 2015-11-27 12:22:20 -05:00
parent 76692235ae
commit 5a15c4997c
6 changed files with 7 additions and 5 deletions

View File

@ -72,7 +72,7 @@ export default Ember.Component.extend({
}
const $elem = this.$();
const minimumResultsForSearch = this.capabilities.touch ? -1 : 5;
const minimumResultsForSearch = this.capabilities.isIOS ? -1 : 5;
$elem.select2({formatResult: this.comboTemplate, minimumResultsForSearch, width: 'resolve'});
const castInteger = this.get('castInteger');

View File

@ -59,7 +59,7 @@ export default Ember.Component.extend({
$input.on('scroll', () => Ember.run.throttle(this, this._syncEditorAndPreviewScroll, 20));
// Focus on the body unless we have a title
if (!this.get('composer.canEditTitle') && !this.capabilities.touch) {
if (!this.get('composer.canEditTitle') && !this.capabilities.isIOS) {
this.$('.d-editor-input').putCursorAtEnd();
}

View File

@ -5,7 +5,7 @@ export default Ember.Component.extend({
@on('didInsertElement')
_focusOnTitle() {
if (!this.capabilities.touch) {
if (!this.capabilities.isIOS) {
this.$('input').putCursorAtEnd();
}
},

View File

@ -100,7 +100,7 @@ export default Ember.Component.extend({
this._watchSizeChanges();
// iOS does not handle scroll events well
if (!this.capabilities.touch) {
if (!this.capabilities.isIOS) {
$(window).on('scroll.discourse-menu-panel', () => this.performLayout());
}
} else {

View File

@ -24,6 +24,8 @@ export default {
caps.isChrome = !!window.chrome && !caps.isOpera;
caps.canPasteImages = caps.isChrome || caps.isFirefox;
}
caps.isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
}
// We consider high res a device with 1280 horizontal pixels. High DPI tablets like

View File

@ -76,7 +76,7 @@ export default Ember.View.extend({
_focusWhenOpened: function() {
// Don't focus on mobile or touch
if (Discourse.Mobile.mobileView || this.capabilities.touch) {
if (Discourse.Mobile.mobileView || this.capabilities.isIOS) {
return;
}