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

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: Fix test 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 5b3879d72a2cd6bd36981149bd1be1dca4831066..ccc69f07ef566ea9830b9b033af07641c8696f44 100644
--- a/chrome/browser/resources/md_bookmarks/dialog_focus_manager.js
+++ b/chrome/browser/resources/md_bookmarks/dialog_focus_manager.js
@@ -47,6 +47,15 @@ cr.define('bookmarks', function() {
showFn();
},
+ /**
+ * Clears the stored focus element, so that focus does not restore when all
+ * dialogs are closed.
+ */
+ clearFocus: function() {
+ this.previousFocusElement_ = null;
+ this.previousMouseFocus_ = false;
+ },
+
/** @private */
updatePreviousFocus_: function() {
this.previousFocusElement_ = this.getFocusedElement_();
@@ -80,7 +89,7 @@ cr.define('bookmarks', function() {
assert(this.dialogs_.delete(dialog));
// Focus the originally focused element if there are no more dialogs.
- if (!this.dialogs_.size) {
+ if (!this.dialogs_.size && this.previousFocusElement_) {
this.previousFocusElement_.focus();
if (this.previousMouseFocus_) {
bookmarks.MouseFocusBehavior.addMouseFocusClass(

Powered by Google App Engine
This is Rietveld 408576698