Skip to content

Commit

Permalink
fix(theme): error when click anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachScript committed Mar 2, 2020
1 parent 24111cd commit 75f7134
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/preset-dumi/src/themes/default/SlugList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const SlugsList: FC<ISlugsListProps> = ({ className, slugs, base }) => {
const listElm = useRef<HTMLUListElement>(null);

function handleAnchorClick(ev, id) {
if (scrollToSlug(id) && listElm.current?.offsetParent.scrollTop < ev.target.offsetTop) {
if (scrollToSlug(id) && listElm.current?.offsetParent?.scrollTop < ev.target.offsetTop) {
listElm.current.offsetParent.scrollTop = ev.target.offsetTop;
}
}
Expand Down

0 comments on commit 75f7134

Please sign in to comment.