From c267ed594b91fe07ec9dfbb3e75d13e1486514a8 Mon Sep 17 00:00:00 2001 From: Thomas Zerr Date: Mon, 16 Sep 2024 19:22:01 +0200 Subject: [PATCH] Fix invalid HTML for file tree and escale query selectors --- scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx | 2 +- scm-ui/ui-components/src/useScrollToElement.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx b/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx index 58d18fce1f..0864a500f5 100644 --- a/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx +++ b/scm-ui/ui-components/src/repos/diff/DiffFileTree.tsx @@ -102,7 +102,7 @@ const TreeNode: FC = ({ 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; `; diff --git a/scm-ui/ui-components/src/useScrollToElement.ts b/scm-ui/ui-components/src/useScrollToElement.ts index 125f9c2990..0e00b679e2 100644 --- a/scm-ui/ui-components/src/useScrollToElement.ts +++ b/scm-ui/ui-components/src/useScrollToElement.ts @@ -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);