Vuetify: Textfield focus() does not focus

Created on 24 Apr 2017  路  4Comments  路  Source: vuetifyjs/vuetify

Steps to reproduce

Visit codepen.io/anon/pen/mmrEGK and click on the button

Versions

Vuetify 0.11.0

What is expected ?

Clicking on the button should focus the textfield

What is actually happening ?

Only the focus decoration is applied to the textfield, but the actual input is not focused

Reproduction Link

codepen.io/anon/pen/mmrEGK

Most helpful comment

Just to follow up on that last comment and save some time for anyone else who shows up here trying to focus a v-text-field in a dialog, the solution is to wrap the focus() call in a nextTick() as described here: https://github.com/vuetifyjs/vuetify/issues/1587#issuecomment-326967711

All 4 comments

I have same issue in 0.12.2.
Small detail: the v-text-field is placed into v-dialog. And I call

showLoginDialog: function () {
        this.$refs.loginTxt.focus();
        this.loginDialog = true;
      },

Just to follow up on that last comment and save some time for anyone else who shows up here trying to focus a v-text-field in a dialog, the solution is to wrap the focus() call in a nextTick() as described here: https://github.com/vuetifyjs/vuetify/issues/1587#issuecomment-326967711

@asoltys thanks.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

Was this page helpful?
0 / 5 - 0 ratings