Skip to content

Blur event is not triggered on the current active element in the click helper #1032

@helgablazhkun

Description

@helgablazhkun

Scenario:
Expected result:
GIVEN There are two elements on the form: focusable input and label (simple div).
AND Input element has focus
WHEN Click on the label occurs (via click test helper)
THEN Input gets blur event and loses its focus

Actual result:
Input doesn't get blur event and doesn't lose its focus

The root cause of the issue is that the blur event is not triggered on the current active element in the click helper in case if the clicked element is not focusable.
If the clicked element is focusable the previous active element gets blur event trough the focus helper.

Proposed solution: Add a call to blur for the case when the clicked element is not focusable.

Real world example: The issue is noticed in the integration test for dropdown component with Ember Power Select in the real application. When click occurs on the dropdown option (non-focusable element) then input doesn't lose its focus in the test but it does in the real application. So Click test helper has different behaviour with browser click.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions