mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Let's be honest: we skip focus for iOS, not touch in general.
This commit is contained in:
parent
76692235ae
commit
5a15c4997c
6 changed files with 7 additions and 5 deletions
|
@ -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');
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ export default Ember.Component.extend({
|
|||
|
||||
@on('didInsertElement')
|
||||
_focusOnTitle() {
|
||||
if (!this.capabilities.touch) {
|
||||
if (!this.capabilities.isIOS) {
|
||||
this.$('input').putCursorAtEnd();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue