Page MenuHomePhabricator

D15135.diff
No OneTemporary

D15135.diff

diff --git a/webroot/rsrc/js/core/behavior-device.js b/webroot/rsrc/js/core/behavior-device.js
--- a/webroot/rsrc/js/core/behavior-device.js
+++ b/webroot/rsrc/js/core/behavior-device.js
@@ -26,6 +26,19 @@
var v = JX.Vector.getViewport();
var self = JX.Device;
+ // Even when we emit a '<meta name="viewport" ... />' tag which tells
+ // devices to fit the conent to the screen width, we'll sometimes measure
+ // a viewport dimension which is larger than the available screen width,
+ // particularly if we check too early.
+
+ // If the device provides a screen width and the screen width is smaller
+ // than the viewport width, use the screen width.
+
+ var screen_width = (window.screen && window.screen.availWidth);
+ if (screen_width) {
+ v.x = Math.min(v.x, screen_width);
+ }
+
var device = 'desktop';
if (v.x <= self._tabletBreakpoint) {
device = 'tablet';

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 27, 1:21 AM (20 h, 53 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6751697
Default Alt Text
D15135.diff (959 B)

Event Timeline