mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 11:48:26 -06:00
TWEAK: Don't focus on progress expansion on touch interfaces.
This commit is contained in:
parent
12a0260a8c
commit
49ae01ddea
@ -6,10 +6,10 @@
|
||||
**/
|
||||
export default {
|
||||
name: "sniff-capabilities",
|
||||
initialize: function() {
|
||||
initialize: function(container, application) {
|
||||
var $html = $('html'),
|
||||
touch = $html.hasClass('touch') || (Modernizr.prefixed("MaxTouchPoints", navigator) > 1),
|
||||
caps = Discourse.Capabilities.current();
|
||||
caps = Ember.Object.create();
|
||||
|
||||
// Store the touch ability in our capabilities object
|
||||
caps.set('touch', touch);
|
||||
@ -24,5 +24,9 @@ export default {
|
||||
// We consider high res a device with 1280 horizontal pixels. High DPI tablets like
|
||||
// iPads should report as 1024.
|
||||
caps.set('highRes', window.screen.width >= 1280);
|
||||
|
||||
// Inject it
|
||||
application.register('capabilities:main', caps, { instantiate: false });
|
||||
application.inject('view', 'capabilities', 'capabilities:main');
|
||||
}
|
||||
};
|
||||
|
@ -1,10 +0,0 @@
|
||||
/**
|
||||
Singleton to store the application's capabilities
|
||||
|
||||
@class Capabilities
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.Capabilities = Ember.Object.extend({});
|
||||
|
||||
Discourse.Capabilities.reopenClass(Discourse.Singleton);
|
@ -77,8 +77,11 @@ export default Ember.View.extend({
|
||||
},
|
||||
|
||||
_focusWhenOpened: function() {
|
||||
// Don't focus on mobile
|
||||
if (Discourse.Mobile.mobileView) { return; }
|
||||
|
||||
// Don't focus on mobile or touch
|
||||
if (Discourse.Mobile.mobileView || this.capabilities.get('touch')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.get('controller.expanded')) {
|
||||
var self = this;
|
||||
|
Loading…
Reference in New Issue
Block a user