[gnome-shell/gnome-3-34] polkitAgent: Only set key focus to password entry after opening dialog



commit a35f9a5226c77a969f380d8435f3e4e78446e4d1
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Mon Jun 24 10:57:24 2019 +0200

    polkitAgent: Only set key focus to password entry after opening dialog
    
    Set the key focus to the password field only after we got a request
    (and therefore know that a password is requested) instead of using
    `setInitialKeyFocus()`. This way we don't try to focus the password
    field by default if we aren't showing it (e.g. in case the user has no
    password or is using fingerprint login).
    
    Also we have to move the call to `grab_key_focus()` to happen after
    `_ensureOpen()`, because otherwise the ModalDialog will set the focus to
    one of the buttons while opening itself.
    
    Cherry-picked from commit 70203b58ca5.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/issues/2066

 js/ui/components/polkitAgent.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/components/polkitAgent.js b/js/ui/components/polkitAgent.js
index bd05526d6c..535814440b 100644
--- a/js/ui/components/polkitAgent.js
+++ b/js/ui/components/polkitAgent.js
@@ -100,7 +100,6 @@ var AuthenticationDialog = GObject.registerClass({
         });
         this._passwordBox.add(this._workSpinner.actor);
 
-        this.setInitialKeyFocus(this._passwordEntry);
         this._passwordBox.hide();
 
         this._errorMessageLabel = new St.Label({ style_class: 'prompt-dialog-error-label' });
@@ -269,9 +268,10 @@ var AuthenticationDialog = GObject.registerClass({
 
         this._passwordBox.show();
         this._passwordEntry.set_text('');
-        this._passwordEntry.grab_key_focus();
         this._updateSensitivity(true);
+
         this._ensureOpen();
+        this._passwordEntry.grab_key_focus();
     }
 
     _onSessionShowError(session, text) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]