1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-13 11:17:26 +02:00
unleash.unleash/frontend/src/component/personalDashboard
Thomas Heartman 134c32589a
fix(1-3375): Fix unintended scroll on dashboard (#9316)
Fixes a bug where the dashboard would scroll you down from the top of
the page on load if your window was too short too see both the
selected flag and the selected project.

This solves it by immediately scrolling to the top of the page after
scrolling your selected element into view. Because this hook only runs
on page load, it shouldn't be safe. (At least I couldn't make this
misbehave with manual testing).

It also changes the list scroll behavior to scroll your selected item
to the top of the list instead of to the bottom (effectively). During
testing, that seems like a better solution to me.

## Background (or why do we auto-scroll here?)

The dashboard's flag and projects panels stores your last selection,
so that when you return to the page you'll be shown what you were
looking at last. This is especially useful if you have a lot of flags
but you're focusing on one in particular.

However, if you **do** have a lot of flags, then it's also quite
likely that your selection will be "below the fold" of the panel, and
you won't see your selected flag/project immediately in the
list (without scrolling).

It seemed like a nice UI affordance to automatically bring your
selected item into view (especially because without it, there's no way
to see what flag/project) you're looking at, so I added the

[`scrollIntoView`](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView)
hook.

What I didn't realize, however, is that it scrolls all scrollable
ancestor containers, which means that if your screen is too short,
it'll scroll you down the page.

From my reading of the docs and some local testing, I don't think
there is a way to limit the scrolling to only the nearest ancestor, so
the easiest way to ensure that we're always at the top seemed to be to
just scroll to the immediately after.
2025-02-17 12:07:35 +01:00
..
ActionBox.tsx feat: personal dashboard scrollbars and spacing (#8493) 2024-10-21 13:14:51 +02:00
AskOwnerToAddYouToTheirProject.tsx refactor: front end code pt II (#8444) 2024-10-15 09:14:24 +00:00
ConnectSDK.tsx refactor: front end code pt II (#8444) 2024-10-15 09:14:24 +00:00
createChartData.ts feat: personal flag metrics display (#8232) 2024-09-24 13:47:21 +02:00
createChartOptions.ts fix: adjust the height of the flag section (#8426) 2024-10-11 10:09:26 +02:00
FlagMetricsChart.tsx fix: don't break personal dashboard charts if the flag is called . (#8807) 2024-11-20 14:38:57 +01:00
InfoSection.tsx fix: link typo for upgrade (#8842) 2024-11-22 16:09:58 +01:00
LatestProjectEvents.tsx feat: remove bold/strong from personal dashboard events (#8330) 2024-11-20 15:40:48 +01:00
MyFlags.tsx fix(1-3375): Fix unintended scroll on dashboard (#9316) 2025-02-17 12:07:35 +01:00
MyProjects.tsx fix(1-3375): Fix unintended scroll on dashboard (#9316) 2025-02-17 12:07:35 +01:00
NoProjectsContactAdmin.tsx refactor: front end code pt II (#8444) 2024-10-15 09:14:24 +00:00
PersonalDashboard.test.tsx chore: remove all deprecated imports of act (#8398) 2024-10-15 13:53:26 +02:00
PersonalDashboard.tsx chore: removes extra border on collapse for the event timeline (#9270) 2025-02-10 10:52:32 +01:00
ProjectDetailsError.tsx fix: handle loading states for project details for a single project (#8492) 2024-10-21 14:27:43 +02:00
ProjectSetupComplete.tsx feat: productivity email action text (#8966) 2024-12-12 12:00:08 +01:00
RemoteData.ts fix: handle loading states for project details for a single project (#8492) 2024-10-21 14:27:43 +02:00
RoleAndOwnerInfo.tsx fix: handle loading states for project details for a single project (#8492) 2024-10-21 14:27:43 +02:00
SharedComponents.tsx feat: move timeline to panel (#9243) 2025-02-06 13:55:59 +00:00
useDashboardState.ts fix: open/close animation on personal dashboard is choppy (#9253) 2025-02-10 10:40:26 +01:00
WelcomeDialog.tsx Update UI text in Unleash welcome key concepts page (#8238) 2024-09-30 11:14:08 +02:00
YourAdmins.tsx refactor: front end code pt II (#8444) 2024-10-15 09:14:24 +00:00