From 94d5ef9caeba68bab012fb436df89db4283b39c7 Mon Sep 17 00:00:00 2001 From: loganhz Date: Mon, 15 Jan 2018 17:10:37 +0800 Subject: [PATCH] Focus username by default https://github.com/rancher/rancher/issues/10845 --- .../addon/components/login-user-pass/component.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/login/addon/components/login-user-pass/component.js b/lib/login/addon/components/login-user-pass/component.js index 558b66ec9..488249179 100644 --- a/lib/login/addon/components/login-user-pass/component.js +++ b/lib/login/addon/components/login-user-pass/component.js @@ -1,4 +1,5 @@ import { computed } from '@ember/object'; +import { next } from '@ember/runloop'; import { inject as service } from '@ember/service'; import Component from '@ember/component'; import { get } from '@ember/object'; @@ -26,5 +27,14 @@ export default Component.extend({ this.set('password',''); this.sendAction('action', code); } - } + }, + + didInsertElement() { + next(() => { + if ( this.isDestroyed || this.isDestroying ) { + return; + } + this.$('INPUT')[0].focus(); + }); + }, });