Skip to content

Focus event ordering is incorrect. #131

Open
@rwjblue

Description

@rwjblue

Demo: https://output.jsbin.com/vilumo

    let element = document.createElement('input');

    ['mousedown', 'mouseup', 'click', 'focus', 'focusin'].forEach(type => {
      element.addEventListener(type, () => {
        console.log('event:', type);
      });
    });

    document.body.appendChild(element);

Tested on MS Edge, FireFox, Chrome, and Safari the output is:

event: mousedown
event: focus
event: focusin
event: mouseup
event: click

However, our utility function fires them as mousedown, focusin, focus, mouseup, click. I noticed this while migrating the implementation to @ember/test-helpers and writing unit tests for the behavior of click.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions