Skip to content

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

Open
@ElVisPL

Description

@ElVisPL

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions