mirror of
https://github.com/outline/outline.git
synced 2026-11-27 07:58:51 +03:00
fix: Comment sidebar should not overtake scrolling if linked to anchor, closes #8296
This commit is contained in:
1 parent
500730b243
commit
dfe97bee50
1 file changed
+3
-3
@@ -54,7 +54,7 @@ function CommentThread({
|
||||
collapseThreshold = 5,
|
||||
collapseNumDisplayed = 3,
|
||||
}: Props) {
|
||||
const [focusedOnMount] = React.useState(focused);
|
||||
const [scrollOnMount] = React.useState(focused && !window.location.hash);
|
||||
const { editor } = useDocumentContext();
|
||||
const { comments } = useStores();
|
||||
const topRef = React.useRef<HTMLDivElement>(null);
|
||||
@@ -165,7 +165,7 @@ function CommentThread({
|
||||
|
||||
React.useEffect(() => {
|
||||
if (focused) {
|
||||
if (focusedOnMount) {
|
||||
if (scrollOnMount) {
|
||||
setTimeout(() => {
|
||||
if (!topRef.current) {
|
||||
return;
|
||||
@@ -209,7 +209,7 @@ function CommentThread({
|
||||
isMarkVisible ? 0 : sidebarAppearDuration
|
||||
);
|
||||
}
|
||||
}, [focused, focusedOnMount, thread.id]);
|
||||
}, [focused, scrollOnMount, thread.id]);
|
||||
|
||||
return (
|
||||
<Thread
|
||||
|
||||
Reference in new issue
Block a user