Vuetify: [Bug Report] Fab v-btn still retains focus after click by default

Created on 14 Dec 2019  路  7Comments  路  Source: vuetifyjs/vuetify

Environment

Vuetify Version: 2.1.14
Vue Version: 2.6.11
Browsers: Chrome 78.0.3904.108
OS: Windows 10

Steps to reproduce

Use fab prop on v-btn component and click it.

Expected Behavior

It should not retain focus on click just like other v-btn types.
Also setting property retain-focus-on-click="false" doesn't work.

Actual Behavior

It retains focus after click.

Reproduction Link

https://codepen.io/milost1982/pen/YzPGQpb?&editable=true&editors=101

invalid

Most helpful comment

I tried asking on discord but didn't get the answer, so I will ask here:
Does "retain-focus-on-click" prop works on "fab" buttons?
If I set: retain-focus-on-click="false" nothing seems to change and focus is still retained after click.

All 7 comments

Isn't it intended?

https://github.com/vuetifyjs/vuetify/blob/v2.2.0-beta.0/packages/vuetify/src/components/VBtn/VBtn.ts

    click (e: MouseEvent): void {
      !this.retainFocusOnClick && !this.fab && e.detail && this.$el.blur()
      this.$emit('click', e)

      this.btnToggle && this.toggle()
    },

This is not a bug.

If you have any additional questions, please reach out to us in our Discord community.

I tried asking on discord but didn't get the answer, so I will ask here:
Does "retain-focus-on-click" prop works on "fab" buttons?
If I set: retain-focus-on-click="false" nothing seems to change and focus is still retained after click.

Dear @johnleider

I have exactly same issue, this is my button:

<v-btn
    color="secondary"
    :style="{'z-index': '10000', left: '50%', bottom: '-25px', transform:'translateX(-50%)'}"
    dark
    absolute
    fab
    retain-focus-on-click
    @click="onAddCartItem">
    <v-icon>mdi-plus</v-icon>
</v-btn>

Once clicked on button it stay focused.

Dear @johnleider

I have exactly same issue, this is my button:

<v-btn
    color="secondary"
    :style="{'z-index': '10000', left: '50%', bottom: '-25px', transform:'translateX(-50%)'}"
    dark
    absolute
    fab
    **retain-focus-on-click**
    @click="onAddCartItem">
    <v-icon>mdi-plus</v-icon>
</v-btn>

Once clicked on button it stay focused.

you have the flag retain-focus-on-click
Youre telling the button to retain it = keep focus

I have the same problem.
NOT a fab button, but focus gets retained and i set
:retain-focus-on-click="false"
just to make sure.

Same as @milost1982 I have a fab button that is still retaining focus after click, even if explicitly putting :retain-focus-on-click="false".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gluons picture gluons  路  3Comments

cawa-93 picture cawa-93  路  3Comments

ricardovanlaarhoven picture ricardovanlaarhoven  路  3Comments

alterhu2020 picture alterhu2020  路  3Comments

milleraa picture milleraa  路  3Comments