Vuetify's autofocus works only on first modal open Vuetify's autofocus works only on first modal open vue.js vue.js

Vuetify's autofocus works only on first modal open


The only thing that worked for me was the v-if="dialog" because the autofocus prop will only work on initial load which is why it was available only for the first time I opened the dialog.

So the working v-tex-field with autofocus in dialog would look something like this:

<v-text-field v-if="dialog" label="Label" autofocus></v-text-field>


In your sandbox (but also seems to be the case in your question) you had an error in your code, you removed return from the provided workaround:

watch: {  dialog (val) {    if (!val) return; // you removed `return` here    requestAnimationFrame(() => {      return this.$refs.focus.focus();    }  });

So actually it works