Fix invalid HTML for file tree and escale query selectors

This commit is contained in:
Thomas Zerr
2024-09-16 19:22:01 +02:00
parent 8f0ed74b7a
commit c267ed594b
2 changed files with 3 additions and 3 deletions

View File

@@ -102,7 +102,7 @@ const TreeNode: FC<NodeProps> = ({ node, parentPath, currentFile, setCurrentFile
type FileProps = { path: string; parentPath: string; currentFile: string; setCurrentFile: (path: string) => void };
export const TreeFileContent = styled.li`
export const TreeFileContent = styled.div`
cursor: pointer;
`;

View File

@@ -39,13 +39,13 @@ const useScrollToElement = (
clearInterval(intervalId);
} else {
tries++;
const element = contentRef.querySelector(elementSelector);
const element = contentRef.querySelector(CSS.escape(elementSelector));
if (element) {
const headerElement = document.querySelector(".navbar-brand");
const margin = headerElement ? headerElement.getBoundingClientRect().height : 45;
clearInterval(intervalId);
const y = element.getBoundingClientRect().top + window.pageYOffset - margin;
window.scrollTo({top: y});
window.scrollTo({ top: y });
}
}
}, 200);