mi6 / ic-design-system

Intelligence Community Design System
https://design.sis.gov.uk
MIT License
43 stars 30 forks source link

Tree view scroll bar appears constantly #1215

Open GCHQ-Developer-741 opened 1 week ago

GCHQ-Developer-741 commented 1 week ago

Summary of the bug

When loading a page on the v3 guidance site for the first time, the subsection nav on the left-hand side has a constant scroll bar appearing, even on pages where there aren't enough options to warrant a scroll bar.

Additionally, because the updateNavigationHeight function does not run until the user scrolls, pages like the components page which do have overflows do not have an enabled scrollbar.

🪜 How to reproduce

Tell us the steps to reproduce the problem:

  1. Go to page: https://mi6.github.io/ic-design-system-githubpages/branches/v3.0.0/develop/components
  2. See the error

📸 Screenshots or code

Chrome: Screenshot 2024-11-19 at 14 45 16 Screenshot 2024-11-19 at 14 09 28

Firefox (w/ dark mode so the height issue is easier to see): Screenshot 2024-11-19 at 14 49 37

🧐 Expected behaviour

Firstly, I would expect the scrollbar to only appear when needed, to not confuse users. Secondly, I would expect the view height to be set on page load, not after the first interaction with the page.

Additional info

Potentially setting the .scroll class to conditionally apply would solve the issue. Or figuring out why it is overflowing in the first place. As for the size issue, could the sizing function be called in the useEffect hook, after being added to the event listeners? Screenshot 2024-11-19 at 15 07 16