File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ function hashLinkScroll(hashFragment) {
5
5
// Push onto callback queue so it runs after the DOM is updated
6
6
setTimeout ( ( ) => {
7
7
const element = document . getElementById ( hashFragment ) ;
8
- if ( element ) element . scrollIntoView ( ) ;
8
+ if ( element !== null ) element . scrollIntoView ( ) ;
9
9
} , 0 ) ;
10
10
}
11
11
@@ -15,10 +15,10 @@ export function HashLink(props) {
15
15
let hashFragment = '' ;
16
16
if ( typeof props . to === 'string' ) {
17
17
hashFragment = props . to . split ( '#' ) . slice ( 1 ) . join ( '#' ) ;
18
- } else if ( typeof props . to === 'object' && props . to . hash ) {
18
+ } else if ( typeof props . to === 'object' && typeof props . to . hash === 'string' ) {
19
19
hashFragment = props . to . hash . replace ( '#' , '' ) ;
20
20
}
21
- if ( hashFragment ) hashLinkScroll ( hashFragment ) ;
21
+ if ( hashFragment !== '' ) hashLinkScroll ( hashFragment ) ;
22
22
}
23
23
return < Link { ...props } onClick = { handleClick } > { props . children } </ Link > ;
24
24
}
You can’t perform that action at this time.
0 commit comments