software-mansion / software-mansion/react-native-enriched-html

[Feature request] Expose caret/cursor screen coordinates

Open
#469 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
1.4k
Forks
66
Avg merge
4d 19h
Merged PRs (30d)
11

Description

Hi there! 👋

First of all, great work on this library — we're really enjoying using it.

I wanted to ask if it would be possible to expose the caret's screen coordinates (x, y) via a callback, something like:

onCaretPositionChange?: (position: { x: number; y: number }) => void;

Why we need this:

We're implementing a mention popup (triggered by @ / # indicators) and we'd love to position it near the caret — similar to how desktop editors like VS Code, Slack, or Notion show autocomplete suggestions right at the cursor.

Currently, onChangeSelection provides character offsets (start, end, text), which is great for text manipulation, but doesn't give us the pixel coordinates needed to position a floating UI element near the caret.

Without screen coordinates, the best we can do is show the mention list relative to the editor container (e.g. pinned to the bottom), which works but isn't as polished as anchoring it to the cursor position.

Is this something that could be supported, or is there a workaround we might be missing? Would love to hear your thoughts.

Thanks!

Contributor guide

No contributing guide indexed for this repository

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 reviewing the existing onChangeSelection callback and the proposed onCaretPositionChange API described in the issue. Determine how screen coordinates should be exposed for mention popups across React Native platforms; done means the callback provides usable x/y caret coordinates.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.