Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2201)

Unified Diff: chrome/browser/resources/settings/list_item_behavior.js

Issue 2375493003: MD Settings: Fix rendering of popup menus inside iron-lists. (Closed)
Patch Set: Static z index. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/list_item_behavior.js
diff --git a/chrome/browser/resources/settings/list_item_behavior.js b/chrome/browser/resources/settings/list_item_behavior.js
new file mode 100644
index 0000000000000000000000000000000000000000..3c4ad1999f86a5efe5a877de03cd0105981689e2
--- /dev/null
+++ b/chrome/browser/resources/settings/list_item_behavior.js
@@ -0,0 +1,22 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @polymerBehavior */
+var ListItemBehavior = {
+ ensureMaxZIndex: function() {
+ // <iron-list> applies translate3d() transform on every element, which
+ // means that in the natural order the (n-1)-th element is at a lower z
+ // index than the n-th element. This prevents the popup menu from being
+ // painted on top of other elements, and therefore a zIndex adjustment is
+ // necessary.
+ this.style.zIndex = ++ListItemBehavior.maxZIndex_;
+ },
+};
+
+/**
+ * The max z index assigned to an <iron-list> item so far. Used to
+ * ensure that the per-item popup menu is displayed correctly.
+ * @private {number}
+ */
+ListItemBehavior.maxZIndex_ = 0;

Powered by Google App Engine
This is Rietveld 408576698