popupMenu: Add focusActor property to define the default focus actor
The PopupMenuManager is supposed to grab and focus the menu actors, with normal menus we always need to grab the actual menu but set the key focus to the source actor so that it will be able to move the focus to the menu child, if requested. However there are menus such as the RenameFolderMenu that requires the key-focus once prompted, so provide a focusActor property (defaulting to the sourceActor) that can be set in order to define the actor to give the keyboard focus to, when the menu is popped-up. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1604 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/720
This commit is contained in:
parent
af1aabff75
commit
54f369404a
@ -428,6 +428,7 @@ var PopupMenuBase = class {
|
|||||||
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
|
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
|
||||||
|
|
||||||
this.sourceActor = sourceActor;
|
this.sourceActor = sourceActor;
|
||||||
|
this.focusActor = sourceActor;
|
||||||
this._parent = null;
|
this._parent = null;
|
||||||
|
|
||||||
if (styleClass !== undefined) {
|
if (styleClass !== undefined) {
|
||||||
@ -1300,10 +1301,11 @@ var PopupMenuManager = class {
|
|||||||
if (open) {
|
if (open) {
|
||||||
if (this.activeMenu)
|
if (this.activeMenu)
|
||||||
this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
|
this.activeMenu.close(BoxPointer.PopupAnimation.FADE);
|
||||||
this._grabHelper.grab({ actor: menu.actor, focus: menu.sourceActor,
|
this._grabHelper.grab({
|
||||||
onUngrab: isUser => {
|
actor: menu.actor,
|
||||||
this._closeMenu(isUser, menu);
|
focus: menu.focusActor,
|
||||||
} });
|
onUngrab: isUser => this._closeMenu(isUser, menu),
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this._grabHelper.ungrab({ actor: menu.actor });
|
this._grabHelper.ungrab({ actor: menu.actor });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user