Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4e6431e

Browse files
Set scroll position direcly
1 parent 38422e3 commit 4e6431e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎src/components/CodePreTag.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ const CodePreTag = ({ children, ...restProps }) => {
55
const syntaxHighlighterEl = useRef(null);
66

77
useEffect(() => {
8-
if (syntaxHighlighterEl.current && syntaxHighlighterEl.current.scroll) {
9-
syntaxHighlighterEl.current.scroll(0, 0);
8+
if (syntaxHighlighterEl.current) {
9+
syntaxHighlighterEl.current.scrollTop = 0;
10+
syntaxHighlighterEl.current.scrollLeft = 0;
1011
}
1112
}, [children]);
1213

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /