From 050aab10d3291e1c80c6dec5acd47c37ec6751f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Man=C3=A9?= Date: Tue, 17 May 2016 09:56:01 -0800 Subject: [PATCH] Another fix for the all-blue-checkboxes in the run selector. It was broken if you opened TensorBoard in a new tab (or anything else triggered a page load when the tab didn't have context). Now we wire the first call to requestAnimationFrame, so it will load when the user views the page. Change: 122541497 --- .../tf-multi-checkbox/tf-multi-checkbox.html | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html b/tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html index 08d98862e5f..a5db63a5e2a 100644 --- a/tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html +++ b/tensorflow/tensorboard/components/tf-multi-checkbox/tf-multi-checkbox.html @@ -190,12 +190,11 @@ handle these situations gracefully. p.customStyle['--paper-checkbox-unchecked-ink-color'] = color; }); this.updateStyles(); - // For some reason, the above updateStyles does not always update the - // styles on first page load, even though it is definitely called after - // the checkboxes are ready. As a hackfix, wait 8ms and then try again. - this.debounce('updateStyles', () => { - this.updateStyles(); - }, 8); + // The updateStyles call fails silently if the browser doesn't have focus, + // e.g. if TensorBoard was opened into a new tab that isn't visible. + // As a workaround... we know requestAnimationFrame won't fire until the + // page has focus, so updateStyles again on requestAnimationFrame. + window.requestAnimationFrame(() => this.updateStyles()); }, _checkboxChange: function(e) { var name = e.srcElement.name;