Page MenuHomePhabricator

D8406.diff
No OneTemporary

D8406.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -7,7 +7,7 @@
return array(
'names' =>
array(
- 'core.pkg.css' => '9cc0bd27',
+ 'core.pkg.css' => 'a903a1ec',
'core.pkg.js' => 'b7bdab05',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => 'd1b3a605',
@@ -26,7 +26,7 @@
'rsrc/css/aphront/lightbox-attachment.css' => '7acac05d',
'rsrc/css/aphront/list-filter-view.css' => 'ef989c67',
'rsrc/css/aphront/multi-column.css' => '12f65921',
- 'rsrc/css/aphront/notification.css' => '6901121e',
+ 'rsrc/css/aphront/notification.css' => 'cf04ca26',
'rsrc/css/aphront/pager-view.css' => '2e3539af',
'rsrc/css/aphront/panel-view.css' => '5846dfa2',
'rsrc/css/aphront/phabricator-nav-view.css' => '80e60fc1',
@@ -401,7 +401,7 @@
'rsrc/js/application/policy/behavior-policy-control.js' => 'c01153ea',
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '263aeb8c',
'rsrc/js/application/ponder/behavior-votebox.js' => '327dbe61',
- 'rsrc/js/application/projects/behavior-project-boards.js' => '1b9facd8',
+ 'rsrc/js/application/projects/behavior-project-boards.js' => 'c526d0a2',
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
'rsrc/js/application/releeph/releeph-preview-branch.js' => '9eb2cedb',
'rsrc/js/application/releeph/releeph-request-state-change.js' => 'fe7fc914',
@@ -444,6 +444,7 @@
'rsrc/js/core/behavior-autofocus.js' => '7319e029',
'rsrc/js/core/behavior-crop.js' => 'b98fc918',
'rsrc/js/core/behavior-dark-console.js' => 'e9fdb5e5',
+ 'rsrc/js/core/behavior-detect-zoom.js' => 'a5d2fb91',
'rsrc/js/core/behavior-device.js' => '03d6ed07',
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '4a11ea9c',
'rsrc/js/core/behavior-error-log.js' => 'a5d7cf86',
@@ -584,6 +585,7 @@
'javelin-behavior-phabricator-active-nav' => 'c81bc98f',
'javelin-behavior-phabricator-autofocus' => '7319e029',
'javelin-behavior-phabricator-busy-example' => 'fbbce3bf',
+ 'javelin-behavior-phabricator-detect-zoom' => 'a5d2fb91',
'javelin-behavior-phabricator-file-tree' => 'c8728c70',
'javelin-behavior-phabricator-gesture' => 'fe2e0ba4',
'javelin-behavior-phabricator-gesture-example' => 'f42bb8c6',
@@ -610,7 +612,7 @@
'javelin-behavior-policy-control' => 'c01153ea',
'javelin-behavior-policy-rule-editor' => '263aeb8c',
'javelin-behavior-ponder-votebox' => '327dbe61',
- 'javelin-behavior-project-boards' => '1b9facd8',
+ 'javelin-behavior-project-boards' => 'c526d0a2',
'javelin-behavior-project-create' => '065227cc',
'javelin-behavior-refresh-csrf' => 'c4b31646',
'javelin-behavior-releeph-preview-branch' => '9eb2cedb',
@@ -699,7 +701,7 @@
'phabricator-menu-item' => '0f386ef4',
'phabricator-nav-view-css' => '80e60fc1',
'phabricator-notification' => '0c6946e7',
- 'phabricator-notification-css' => '6901121e',
+ 'phabricator-notification-css' => 'cf04ca26',
'phabricator-notification-menu-css' => 'fc9a363c',
'phabricator-object-list-view-css' => '1a1ea560',
'phabricator-object-selector-css' => '029a133d',
@@ -937,15 +939,6 @@
1 => 'javelin-util',
2 => 'phabricator-keyboard-shortcut-manager',
),
- '1b9facd8' =>
- array(
- 0 => 'javelin-behavior',
- 1 => 'javelin-dom',
- 2 => 'javelin-util',
- 3 => 'javelin-stratcom',
- 4 => 'javelin-workflow',
- 5 => 'phabricator-draggable-list',
- ),
'1e1c8a59' =>
array(
0 => 'javelin-behavior',
@@ -1490,6 +1483,12 @@
2 => 'javelin-stratcom',
3 => 'javelin-dom',
),
+ 'a5d2fb91' =>
+ array(
+ 0 => 'javelin-behavior',
+ 1 => 'phabricator-notification',
+ 2 => 'phabricator-phtize',
+ ),
'a5d7cf86' =>
array(
0 => 'javelin-dom',
@@ -1663,6 +1662,15 @@
1 => 'javelin-stratcom',
2 => 'javelin-behavior',
),
+ 'c526d0a2' =>
+ array(
+ 0 => 'javelin-behavior',
+ 1 => 'javelin-dom',
+ 2 => 'javelin-util',
+ 3 => 'javelin-stratcom',
+ 4 => 'javelin-workflow',
+ 5 => 'phabricator-draggable-list',
+ ),
'c54eeefb' =>
array(
0 => 'javelin-install',
diff --git a/src/view/page/PhabricatorStandardPageView.php b/src/view/page/PhabricatorStandardPageView.php
--- a/src/view/page/PhabricatorStandardPageView.php
+++ b/src/view/page/PhabricatorStandardPageView.php
@@ -167,6 +167,15 @@
));
Javelin::initBehavior('device');
+ Javelin::initBehavior(
+ 'phabricator-detect-zoom',
+ array(
+ 'pht' => array(
+ 'zoomed' => pht(
+ 'Your browser window is zoomed to X%%. Phabricator may not '.
+ 'display properly.'),
+ ),
+ ));
if ($console) {
require_celerity_resource('aphront-dark-console-css');
diff --git a/webroot/rsrc/css/aphront/notification.css b/webroot/rsrc/css/aphront/notification.css
--- a/webroot/rsrc/css/aphront/notification.css
+++ b/webroot/rsrc/css/aphront/notification.css
@@ -47,6 +47,11 @@
border: 1px solid {$red};
}
+.jx-notification-utility {
+ background: {$lightorange};
+ border: 1px solid {$orange};
+}
+
.jx-notification-container .phabricator-notification {
padding: 0;
}
diff --git a/webroot/rsrc/js/core/behavior-detect-zoom.js b/webroot/rsrc/js/core/behavior-detect-zoom.js
new file mode 100644
--- /dev/null
+++ b/webroot/rsrc/js/core/behavior-detect-zoom.js
@@ -0,0 +1,33 @@
+/**
+ * @provides javelin-behavior-phabricator-detect-zoom
+ * @requires javelin-behavior
+ * phabricator-notification
+ * phabricator-phtize
+ */
+
+/**
+ * Detect that the user has zoomed their browser in or out and warn them about
+ * it, since it can cause a variety of display glitches which get reported as
+ * bugs, and these bugs are hard to immediately diagnose since it's often not
+ * obvious that a browser is at 90% or 110% zoom. See discussion in T4556.
+ */
+JX.behavior('phabricator-detect-zoom', function(config) {
+ var pht = JX.phtize(config.pht);
+
+ // There appears to be no standard or reasonable way to detect zoom levels,
+ // and essentially every browser and browser version has some kind of unique
+ // mess. This seems to work in recent Chrome, which is where we get most of
+ // our zoom-level reports.
+
+ var iw = window.innerWidth;
+ var ow = window.outerWidth;
+
+ // Round the zoom level to the nearest 10%.
+ var zoom = 10 * Math.round((ow / iw) * 10);
+ if (zoom != 100) {
+ new JX.Notification()
+ .setContent(pht('zoomed').replace('X%', zoom + '%'))
+ .alterClassName('jx-notification-utility', true)
+ .show();
+ }
+});

File Metadata

Mime Type
text/plain
Expires
Jul 24 2025, 8:15 AM (13 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8588693
Default Alt Text
D8406.diff (6 KB)

Event Timeline