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

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: Nit 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..462c8f22b46a23ea2d8410e3df8fc103ae92bd8c
--- /dev/null
+++ b/chrome/browser/resources/settings/list_item_behavior.js
@@ -0,0 +1,27 @@
+// 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.
+
+cr.define('settings', function() {
stevenjb 2016/09/26 22:52:00 Optional: It seems like this might be generally us
dpapad 2016/09/26 23:04:32 Prefer to wait until the 2nd client of this class
+ /**
+ * The max z index assigned to an <iron-list> item so far. Used to
+ * ensure that the per-item popup menu is displayed correctly.
+ * @type {number}
+ */
+ var maxZIndex = 0;
stevenjb 2016/09/26 22:52:00 nit: maxZIndex_ since it's private
dpapad 2016/09/26 23:04:32 Done.
+
+ var ListItemBehavior = {
+ showActionMenu: 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 = ++maxZIndex;
+ },
+ };
+
+ return {
+ ListItemBehavior: ListItemBehavior,
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698