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

Unified Diff: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js

Issue 2815623005: MD Settings: in cr_dialog, prevent intersectionObserver from firing early. (Closed)
Patch Set: add test Created 3 years, 8 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
« no previous file with comments | « chrome/test/data/webui/cr_elements/cr_dialog_test.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
diff --git a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
index c98c75ac4053eda397cdc7758103f9edb91fd87d..3fa57b54f22259340cbfa7f52f7c942e355872b1 100644
--- a/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
+++ b/ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js
@@ -45,6 +45,8 @@ Polymer({
},
},
+ observers: ['onOpenChanged_(open)'],
dpapad 2017/04/13 01:12:12 You probably checked this already, but does this w
scottchen 2017/04/13 20:17:51 It does work, but unfortunately found out that obs
+
/** @private {?IntersectionObserver} */
intersectionObserver_: null,
@@ -61,9 +63,13 @@ Polymer({
this.addEventListener('keypress', this.onKeypress_.bind(this));
},
- /** @override */
- attached: function() {
- if (this.showScrollBorders) {
+ /** @private */
+ onOpenChanged_: function() {
+ if (!this.showScrollBorders) {
+ return;
+ }
+
+ if (this.open !== null && !this.intersectionObserver_) {
var bodyContainer = this.$$('.body-container');
var bottomMarker = this.$.bodyBottomMarker;
@@ -89,14 +95,10 @@ Polymer({
root: bodyContainer,
threshold: 0,
}));
+
this.intersectionObserver_.observe(bottomMarker);
this.intersectionObserver_.observe(topMarker);
- }
- },
-
- /** @override */
- detached: function() {
- if (this.intersectionObserver_) {
+ } else if (this.open === null && this.intersectionObserver_) {
this.intersectionObserver_.disconnect();
this.intersectionObserver_ = null;
}
« no previous file with comments | « chrome/test/data/webui/cr_elements/cr_dialog_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698