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

Unified Diff: chrome/browser/resources/md_bookmarks/dialog_focus_manager.js

Issue 2977523002: MD Bookmarks: Scroll and select items that are added to the main list (Closed)
Patch Set: Review comments Created 3 years, 5 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/md_bookmarks/dialog_focus_manager.js
diff --git a/chrome/browser/resources/md_bookmarks/dialog_focus_manager.js b/chrome/browser/resources/md_bookmarks/dialog_focus_manager.js
index 98c0fd34e84411460162132e3eb9ef549879f831..cad7d7ea17c230fe336855edcbe987524dcf5643 100644
--- a/chrome/browser/resources/md_bookmarks/dialog_focus_manager.js
+++ b/chrome/browser/resources/md_bookmarks/dialog_focus_manager.js
@@ -51,6 +51,14 @@ cr.define('bookmarks', function() {
return this.dialogs_.size > 0;
},
+ /**
+ * Clears the stored focus element, so that focus does not restore when all
+ * dialogs are closed.
+ */
+ clearFocus: function() {
+ this.previousFocusElement_ = null;
+ },
+
/** @private */
updatePreviousFocus_: function() {
this.previousFocusElement_ = this.getFocusedElement_();
@@ -82,7 +90,7 @@ cr.define('bookmarks', function() {
assert(this.dialogs_.delete(dialog));
// Focus the originally focused element if there are no more dialogs.
- if (!this.hasOpenDialog())
+ if (!this.hasOpenDialog() && this.previousFocusElement_)
this.previousFocusElement_.focus();
dialog.removeEventListener('close', closeListener);

Powered by Google App Engine
This is Rietveld 408576698