Skip to content

.trigger("focus") doesn't work anymore for contenteditable element #1932

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

Open
ElVisPL opened this issue Nov 24, 2021 · 1 comment
Open

.trigger("focus") doesn't work anymore for contenteditable element #1932

ElVisPL opened this issue Nov 24, 2021 · 1 comment
Labels

Comments

@ElVisPL
Copy link

ElVisPL commented Nov 24, 2021

Subject of the issue

.trigger("focus") doesn't work anymore for contenteditable elements.

It works only on input elements.

It is working on 1.1.3. I think PR1777 introduced this regression

Steps to reproduce

Test:

 wrapper.find(".input-field").trigger("focus")
 expect(wrapper.emitted("focus")).toBeTruthy()

Component:

 <div class="input-field" contenteditable @focus="onFocus" />
...
onFocus() {
  this.$emit("focus")
}

Expected behaviour

Event should be triggered

Actual behaviour

Event is not triggered

Possible Solution

This is workaround:
wrapper.find(".input-field").element.dispatchEvent(new Event("focus")).
But I guess .trigger("focus") is also expected to work for contenteditable

@dominik-bln
Copy link

We are seeing the same problem for button elements on v1, but only when updating to Jest 27.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants