techdocs: sidebars not adjusting positions

Signed-off-by: Adrian Ke <adrian.ke@grabtaxi.com>
This commit is contained in:
Adrian Ke
2021-07-06 16:45:39 +08:00
parent 43301edd13
commit 2a4a3b32dd
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-techdocs': patch
---
Techdocs: fix sidebars not adjusting position automatically
@@ -82,10 +82,10 @@ export const Reader = ({ entityId, onReady }: Props) => {
useEffect(() => {
updateSidebarPosition();
window.addEventListener('scroll', updateSidebarPosition);
window.addEventListener('scroll', updateSidebarPosition, true);
window.addEventListener('resize', updateSidebarPosition);
return () => {
window.removeEventListener('scroll', updateSidebarPosition);
window.removeEventListener('scroll', updateSidebarPosition, true);
window.removeEventListener('resize', updateSidebarPosition);
};
// an update to "state" might lead to an updated UI so we include it as a trigger