Skip to content

Commit 49bcf21

Browse files
authored
Fix scrollToHash to handle IDs starting with a number
1 parent 626c224 commit 49bcf21

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/routers/createRouter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export function bindEvent(target: EventTarget, type: string, handler: EventListe
6565
}
6666

6767
export function scrollToHash(hash: string, fallbackTop?: boolean) {
68-
const el = querySelector(`#${hash}`);
68+
const el = querySelector(`#${hash}`) ?? document.getElementById(hash);
6969
if (el) {
7070
el.scrollIntoView();
7171
} else if (fallbackTop) {

0 commit comments

Comments
 (0)