Skip to content

Commit 849551a

Browse files
authored
fix:[M3-10335] - useIsPageScrollable hook is not working correctly for slightly taller pages (#12695)
* Create debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Update debug-M3-9877.yml * Make fix * Remove debug .yml file * Revert to old method and use footer height calculation instead * Added changeset: Include footer height in useIsPageScrollable calculation
1 parent 0083720 commit 849551a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
Include footer height in useIsPageScrollable calculation ([#12695](https://github.com/linode/manager/pull/12695))

packages/manager/src/components/PrimaryNav/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22

3+
import { FOOTER_HEIGHT } from 'src/features/Footer';
34
import { TOPMENU_HEIGHT } from 'src/features/TopMenu/constants';
45

56
import type { LinkProps } from '@tanstack/react-router';
@@ -41,7 +42,9 @@ export const useIsPageScrollable = (
4142

4243
const contentHeight = contentRef.current.scrollHeight;
4344
const viewportHeight = document.documentElement.clientHeight;
44-
setIsPageScrollable(contentHeight + TOPMENU_HEIGHT > viewportHeight);
45+
setIsPageScrollable(
46+
contentHeight + TOPMENU_HEIGHT + FOOTER_HEIGHT > viewportHeight
47+
);
4548
}, [contentRef]);
4649

4750
React.useEffect(() => {

packages/manager/src/features/Footer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { DEVELOPERS_LINK, FEEDBACK_LINK } from 'src/constants';
77

88
import packageJson from '../../package.json';
99

10+
export const FOOTER_HEIGHT = 45;
11+
1012
export const Footer = React.memo(() => {
1113
return (
1214
<footer role="contentinfo">

0 commit comments

Comments
 (0)