basecamp / basecamp/trix

Function getClientRectAtPosition produces incorrect results

Open
#1,164 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
20k
Forks
1.1k
Avg merge
3d 12h
Merged PRs (30d)
13

Description

When using the function `getClientRectAtPosition` if the caret position is at the end of a line, the results return the location of the start of the next line on Chromium based browsers. (Oddly, Firefox does not appear to have the issue.)

##### Steps to Reproduce
I've created a simple demonstration here:

https://codepen.io/awiredprairie/pen/jOoXGoz

##### Details

* Trix version: 2.1.1
* Browser name and version: Chrome, Edge (Version 125.0.2535.85)
* Operating system: Windows 11

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the behavior in the linked CodePen and tracing the getClientRectAtPosition entry point in Trix 2.1.1. Compare caret positions at the end of a line in Chromium-based browsers with Firefox. Done means the function returns the caret location rather than the start of the next line in the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.