mdx-editor / mdx-editor/editor

[BUG] Link Popover position is incorrect after window resized

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

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
3.7k
Forks
307
Avg merge
14h 22m
Merged PRs (30d)
5

Description

  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • I have read the documentation and cannot find an answer.

Describe the bug
Link Popover position is incorrect after window resized

To Reproduce
Steps to reproduce the behavior:

  1. Open https://mdxeditor.dev/editor/demo
  2. Click on the link [— Daring Fireball](https://daringfireball.net/projects/markdown/), the link popover is displayed right near the link as expected
  3. Click anywhere on the webpage to let editor lose focus. Make sure the editor loses focus, otherwise the bug can not be reproduced.
  4. Resize the window.
  5. See error: the link popover is on the top-left corner. It's expected to stay close to the link.

Expected behavior
At the last step, the link popover is expected to stay close to the link.

Screenshots
Snipaste_2024-09-07_00-49-23

Desktop (please complete the following information):

  • OS: MacOS
  • Browser [e.g. Chrome, Safari]: Chrome 128.0.6587.0, Firefox 129.0.2 (64-bit).

Mobile:

  • OS: iOS 17.5.1
  • Browser: Safari

Additional context
LinkDialog.tsx fires publishWindowChange(true) when resizing happens, but link anchor is set to left:0; top:0 when editor loses focus.

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 with LinkDialog.tsx and reproduce the sequence in the MDXEditor demo: open the link popover, let the editor lose focus, then resize the window. Trace how publishWindowChange(true) interacts with the link anchor's left:0 and top:0 position. Done means the popover remains close to the link after resizing while the editor is unfocused.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.