testing-library / testing-library/user-event

Get pointer targets in environments that support layout

Open
#846 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
2.3k
Forks
258
PR merge metrics
No merged PRs in 30d

Description

Problem description

An increasing number of our users applies this library in test environments which support layout.
In those environments given the clientX/clientY coordinates of a pointer device, we could detect the target of pointer interactions automatically and improve the confidence our users get from their tests.

Suggested solution

If a user supplies x/y coordinates for pointer interactions, determine related DOM node(s) and position automatically.

If a target and or node/offset is given and contradicts the determined element/position, throw an error.

Todo

It would be great if we could support not declaring a target in the API call.
So far we reuse the previous pointer position for subsequent pointer actions. This begs the question how we would determine if we keep the coordinates and/or the target as a reference point.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the pointer interaction API described in the issue and review Document.elementFromPoint(), caretPositionFromPoint(), and caretRangeFromPoint(). Done means x/y coordinates determine the element and selection position, contradictory target or node/offset values error, and subsequent pointer actions have defined coordinate and target behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.