Skip to content

RFC: UserEvent to throw errors in case element is disabled or not focusable #1443

Closed as not planned
@mdjastrzebski

Description

@mdjastrzebski

Describe the Feature

User Event should throw errors in case of given element is disabled in any way that prevents the interaction to run in order to improve DX.

OG User Event does throw errors in similar cases for clear(), and click()/pointer() interactions.

Note: This would be a breaking change, but according to User Event beta status would only trigger a minor change in the version.

Note 2: In the past we fireEvent was already throwing errors in the past when no enable event handler was found but that has been removed. Here are refs to the issue: #469, and PR #470

Possible Implementations

  • type() & clear() should throw helpful error when element is not editable or not focusable due to pointerEvent prop on itself or any ancestor
  • press() should throw helpful error when element is not pressable due to pointerEvents prop on itself on ancestor.

These should not throw in case no event handler is found, as user interaction can invoke multiple events handler, hence any particular event handler is optional.

Related Issues

Initial discussion

CC: @pierrezimmermannbam @MattAgn @AugustinLF @thymikee

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions