diff --git a/src/components/lexicon-schema.tsx b/src/components/lexicon-schema.tsx
index 2052c52..3647d21 100644
--- a/src/components/lexicon-schema.tsx
+++ b/src/components/lexicon-schema.tsx
@@ -294,25 +294,13 @@ const DefSection = (props: { name: string; def: LexiconDef }) => {
props.def.items ||
props.def.knownValues;
- const handleHeaderClick = () => {
- window.history.replaceState(null, "", `#schema:${props.name}`);
- const element = document.getElementById(`def-${props.name}`);
- if (element) {
- element.scrollIntoView({ behavior: "instant", block: "start" });
- }
- };
-
return (
-
+
{props.def.type}
@@ -523,8 +511,10 @@ export const LexiconSchemaView = (props: { schema: LexiconSchema }) => {
const hash = location.hash;
if (hash.startsWith("#schema:")) {
const defName = hash.slice(8);
- const element = document.getElementById(`def-${defName}`);
- if (element) element.scrollIntoView({ behavior: "instant", block: "start" });
+ requestAnimationFrame(() => {
+ const element = document.getElementById(`def-${defName}`);
+ if (element) element.scrollIntoView({ behavior: "instant", block: "start" });
+ });
}
});