Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit f503768

Browse files
committed
Fix bug #7402 (Focus not set to inline editor after creating new rule) - If
the client of the DropdownButton changes focus in respond to the "select" event that closes it, leave focus in that new location. Only restore focus to where it was before dropdown closed if no one has touched the focus while closing.
1 parent 90bf018 commit f503768

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/widgets/DropdownButton.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,14 @@ define(function (require, exports, module) {
188188
DropdownButton.prototype._onDropdownClose = function () {
189189
window.document.body.removeEventListener("click", this._onClickOutside, true);
190190
$(PanelManager).off("editorAreaResize", this.closeDropdown);
191+
192+
// Restore focus to old pos, unless "select" handler changed it
193+
if (window.document.activeElement === this.$dropdown[0]) {
194+
this._lastFocus.focus();
195+
}
196+
191197
this._dropdownEventHandler = null;
192198
this.$dropdown = null; // already remvoed from DOM automatically by PopUpManager
193-
194-
this._lastFocus.focus(); // restore focus to old pos
195199
};
196200

197201
/** Closes the dropdown if currently open */

0 commit comments

Comments
 (0)