This PR updates the code that decides which element to select is in view while scrolling.
Also adds logic to show the exempted cookies section always when CDP is on, even if the count is zero.
Relevant Technical Choices
Earlier implementation had a cutoff line in the center, which meant if the element's half height passed through the viewport's middle, we showed it selected in the menubar.
Now updated logic will consider the first quarter of the viewport to judge whether the element should be shown in view or not.
If the element hasn't been scrolled more than a 3/4th of its height out of the viewport's 1/4th height.
Testing Instructions
Open the PSAT panel and navigate to the cookie landing page (CDP off).
Select the Blocked Cookies section from the menu bar.
Reload the page and the Blocked cookies section should remain selected.
Description
This PR updates the code that decides which element to select is in view while scrolling.
Relevant Technical Choices
Testing Instructions
Additional Information:
Screenshot/Screencast
https://github.com/GoogleChromeLabs/ps-analysis-tool/assets/58820001/3d2a5575-77f3-4d44-8fc6-303aadf5aee8
Checklist
Fixes #697