Commit 1a471737 authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

MD Extensions: ensure toast is displayed above other elements and stays open while updating

Bug: 819996
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Iab8fa2d66ab07cc0f8c0c9c4509f40563dfe0dd6
Reviewed-on: https://chromium-review.googlesource.com/956242
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543897}
parent 034d1f90
...@@ -252,6 +252,7 @@ ...@@ -252,6 +252,7 @@
{ {
'target_name': 'toolbar', 'target_name': 'toolbar',
'dependencies': [ 'dependencies': [
'<(DEPTH)/ui/webui/resources/cr_elements/cr_toast/compiled_resources2.gyp:cr_toast',
'<(DEPTH)/third_party/polymer/v1_0/components-chromium/iron-a11y-announcer/compiled_resources2.gyp:iron-a11y-announcer-extracted', '<(DEPTH)/third_party/polymer/v1_0/components-chromium/iron-a11y-announcer/compiled_resources2.gyp:iron-a11y-announcer-extracted',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:i18n_behavior', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:i18n_behavior',
......
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
title="$i18n{toolbarUpdateNowTooltip}"> title="$i18n{toolbarUpdateNowTooltip}">
$i18n{toolbarUpdateNow} $i18n{toolbarUpdateNow}
</paper-button> </paper-button>
<cr-toast duration="3000"> <cr-toast>
<div>[[toastLabel_]]</div> <div>[[toastLabel_]]</div>
</cr-toast> </cr-toast>
<if expr="chromeos"> <if expr="chromeos">
......
...@@ -73,6 +73,13 @@ cr.define('extensions', function() { ...@@ -73,6 +73,13 @@ cr.define('extensions', function() {
role: 'banner', role: 'banner',
}, },
/** @override */
detached: function() {
const openToastElement = this.$$('cr-toast[open]');
if (openToastElement)
openToastElement.hide();
},
/** /**
* @return {boolean} * @return {boolean}
* @private * @private
...@@ -149,6 +156,9 @@ cr.define('extensions', function() { ...@@ -149,6 +156,9 @@ cr.define('extensions', function() {
this.isUpdating_ = true; this.isUpdating_ = true;
const toastElement = this.$$('cr-toast'); const toastElement = this.$$('cr-toast');
this.toastLabel_ = this.i18n('toolbarUpdatingToast'); this.toastLabel_ = this.i18n('toolbarUpdatingToast');
// Keep the toast open indefinitely.
toastElement.duration = 0;
toastElement.show(); toastElement.show();
this.delegate.updateAllExtensions() this.delegate.updateAllExtensions()
.then(() => { .then(() => {
...@@ -156,10 +166,11 @@ cr.define('extensions', function() { ...@@ -156,10 +166,11 @@ cr.define('extensions', function() {
const doneText = this.i18n('toolbarUpdateDone'); const doneText = this.i18n('toolbarUpdateDone');
this.fire('iron-announce', {text: doneText}); this.fire('iron-announce', {text: doneText});
this.toastLabel_ = doneText; this.toastLabel_ = doneText;
toastElement.show(); toastElement.show(3000);
this.isUpdating_ = false; this.isUpdating_ = false;
}) })
.catch(function() { .catch(function() {
toastElement.hide();
this.isUpdating_ = false; this.isUpdating_ = false;
}); });
}, },
......
...@@ -50,10 +50,6 @@ ...@@ -50,10 +50,6 @@
padding: 8px; padding: 8px;
} }
#undoToast {
z-index: 1;
}
#exportImportMenuButtonContainer { #exportImportMenuButtonContainer {
-webkit-margin-end: 0; -webkit-margin-end: 0;
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
transition: opacity 300ms, transform 300ms, visibility 300ms; transition: opacity 300ms, transform 300ms, visibility 300ms;
visibility: hidden; visibility: hidden;
white-space: nowrap; white-space: nowrap;
z-index: 1;
} }
:host([open]) { :host([open]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment