Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] v-btn throws an error when a click is simulated #12270

Closed
matthew-dean opened this issue Sep 22, 2020 · 2 comments
Closed

[Bug Report] v-btn throws an error when a click is simulated #12270

matthew-dean opened this issue Sep 22, 2020 · 2 comments
Labels
invalid The issue is missing information or is not a valid bug/feature request

Comments

@matthew-dean
Copy link

Environment

Vuetify Version: 2.3.10
Vue Version: 2.6.11
Browsers: Chrome 85.0.4183.102
OS: Mac OS 10.15.6

Steps to reproduce

  1. Attach a ref to a v-btn
  2. Fire this.$refs[button].click()
  3. The error in console is "Cannot read property 'detail' of undefined

Expected Behavior

A button element should allow simulated clicks. In this case, it's because, for accessibility reasons, buttons in our app are triggered with the keyboard. I would have expected to see the click animation (ideally from center, but from 0,0 if an event is not provided is fine too).

Actual Behavior

It just throws an error and gives no visual feedback.

Reproduction Link

https://codepen.io/matthewdean/pen/GRZPZEj

@ghost ghost added the S: triage label Sep 22, 2020
@matthew-dean
Copy link
Author

Note: I was able to workaround this with:

        const el = this.$refs.button?.$el
        if (el) {
          el.dispatchEvent(new MouseEvent('mousedown'))
        }

Should I close this?

@KaelWD
Copy link
Member

KaelWD commented Sep 24, 2020

Use this.$refs.button.$el.click()

@KaelWD KaelWD closed this as completed Sep 24, 2020
@KaelWD KaelWD added invalid The issue is missing information or is not a valid bug/feature request and removed S: triage labels Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid The issue is missing information or is not a valid bug/feature request
Projects
None yet
Development

No branches or pull requests

2 participants