[editor/diffs] Render marker popup in overlay element - #825
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4b31c7504
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ], | ||
| }, | ||
| preElement | ||
| overlayElement |
There was a problem hiding this comment.
Keep marker popups outside the clipped code scroller
When the popup is appended to overlayElement, it becomes an absolutely positioned child of the [data-code] scroller because the editor overlay is display: contents; the inspected stylesheet gives [data-code] overflow: ... scroll clip. For a marker on the last rendered/file line, y is computed as the line top plus one line height, so the popup starts at the bottom of the clipped scroller and is hidden instead of being visible below the line.
Useful? React with 👍 / 👎.
| const lineHeight = getLineHeight(); | ||
| const y = getLineY(line) + wrapLine * lineHeight + lineHeight; | ||
| const transform = `translateX(${codeElement.offsetLeft + left}px) translateY(${codeElement.offsetTop + y}px)`; | ||
| const transform = `translateX(${left}px) translateY(${y}px)`; |
There was a problem hiding this comment.
left and y is cached, this reduces reflow
d4b31c7 to
bbb3f96
Compare
|
Tested locally in my /edit page demos and all looks good. |
Render marker popup in overlay element
Render marker popup in overlay element
Render marker popup in overlay element
…#825) Render marker popup in overlay element
Render marker popup in overlay element
This pr fixes scrolling error when a marker popup showing.