Skip to content

Only first focus event is dispatched on element #1939

Open
@GadQ

Description

@GadQ

Subject of the issue

After updating to 1.1.4 (and every version above) elements don't trigger focus after first focus and blur.

Steps to reproduce

Here is the minimal reproduction repo: https://github.com/GadQ/vue-test-utils-double-focus
There are two tests:

  • first, with alternating focus on 2 inputs - it works always
  • second, with focus, blur, focus on 1 input - it works in 1.1.3, and stopped working in 1.1.4

Expected behaviour

Both test should pass as it was before 1.1.4.

Actual behaviour

Second test fails.

Possible Solution

In 1.1.4 new focusEventTrigger was introduced:

const focusEventTrigger = (type, options) => {
  if (this.element instanceof HTMLElement) {
     return this.element.focus()
  }

  regularEventTrigger(type, options)
}

When I comment out this new line: return this.element.focus() it works as expected

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