You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 29, 2024. It is now read-only.
Notice how, by changing any text style after scrolling down, the toolbar moves up (by what seems to be the scroll offset from the parent container). The position gets calculated correctly when the element is not "sticky-ed".
I've done some debugging and the issue seems to be the function getSelectionRect (/src/util/index.js), which calls the getBoundingClientRect function on the selection range.
I am not quite sure why the native getBoundingClientRect function returns the wrong top value but it might have something to do with the component re-render right after a style-change.
Wrapping the getSelectionRect function call inside a requestAnimationFrame solves the issue but I am not sure it's the correct way to fix it.
Demo: https://codesandbox.io/s/j7k68l7833 (see /src/medium-draft/components/toolbar.js:85)
I would like to get some feedback before creating a PR.
The text was updated successfully, but these errors were encountered:
Hello,
I am having an issue with the toolbar position when the Editor is rendered inside a
position: sticky
element.Demo: https://codesandbox.io/s/kk6p74226o
Notice how, by changing any text style after scrolling down, the toolbar moves up (by what seems to be the scroll offset from the parent container). The position gets calculated correctly when the element is not "sticky-ed".
I've done some debugging and the issue seems to be the function
getSelectionRect
(/src/util/index.js), which calls thegetBoundingClientRect
function on the selection range.I am not quite sure why the native
getBoundingClientRect
function returns the wrongtop
value but it might have something to do with the component re-render right after a style-change.Wrapping the
getSelectionRect
function call inside arequestAnimationFrame
solves the issue but I am not sure it's the correct way to fix it.Demo: https://codesandbox.io/s/j7k68l7833 (see /src/medium-draft/components/toolbar.js:85)
I would like to get some feedback before creating a PR.
The text was updated successfully, but these errors were encountered: