Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page: Use browser native scrollbars for the main page content #82919

Merged
merged 8 commits into from
Mar 6, 2024

Conversation

joshhunt
Copy link
Contributor

@joshhunt joshhunt commented Feb 16, 2024

This PR removes the <CustomScrollbar /> component from the main <Page />, to prefer using platform default scrollbars. This behaviour is controlled via the betterPageScrolling feature toggle, which is enabled by default.

As raised in #80429, there's now cross-browser support for customising the native browser scrollbar in a limited and declarative manner. However, I believe there is little need to customise the scroll bar at at least the page level - we should defer to doing less and preferring platform defaults.

This PR adds a new 'FlaggedScrollbars' interim component that wraps grafana-ui's CustomScrollbars, or uses a NativeScrollbars component when the toggle is enabled. The goal is to later remove FlaggedScrollbars and NativeScrollbars, and just scroll the document body element.

Part of #80429

Screenshots

On Windows, Chrome does not use 'overlay' scroll bars, so they used to get CustomScrollbars. Firefox does use overlay scroll bars, is it never used CustomScrollbars, and should see no change through this

Regular tall page

Before (default) Before (hover) After Firefox
image image image image

Non-scrolling page

Before After Firefox
image image image

Small dashboard without scroll bars

Before After Firefox
image image image

Large dashboard with scroll bars

Before After Firefox
image image image

@joshhunt joshhunt changed the title Page: Page: Remove CustomScrollbars from main Page scrolling Feb 16, 2024
@joshhunt joshhunt force-pushed the joshhunt/no-custom-page-scrollbars branch from c767bb7 to ae9a5ad Compare February 29, 2024 10:33
@joshhunt joshhunt force-pushed the joshhunt/no-custom-page-scrollbars branch 4 times, most recently from 90ca002 to fc5627b Compare March 4, 2024 16:06
@joshhunt joshhunt changed the title Page: Remove CustomScrollbars from main Page scrolling Page: Use browser native scrollbars for the main page content Mar 4, 2024
@joshhunt joshhunt marked this pull request as ready for review March 4, 2024 19:54
@joshhunt joshhunt requested review from grafanabot and a team as code owners March 4, 2024 19:54
@joshhunt joshhunt requested review from ashharrison90 and eledobleefe and removed request for a team March 4, 2024 19:54
color: theme.v1.palette.blue95,
}),
cards: css({
overflowX: 'auto',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual change here is from overflow-x: scroll to overflow-x: auto to prevent the scroll bars from showing when there's no overflow.

@joshhunt joshhunt added this to the 11.0.x milestone Mar 4, 2024
@grafana grafana deleted a comment from ephemeral-instances-bot bot Mar 4, 2024
@grafana grafana deleted a comment from ephemeral-instances-bot bot Mar 4, 2024
@grafana grafana deleted a comment from ephemeral-instances-bot bot Mar 4, 2024
@grafana grafana deleted a comment from ephemeral-instances-bot bot Mar 4, 2024
@joshhunt joshhunt force-pushed the joshhunt/no-custom-page-scrollbars branch from 6066da0 to f92815d Compare March 4, 2024 21:42
@ryantxu

This comment was marked as resolved.

@ephemeral-instances-bot
Copy link

@grafana grafana deleted a comment from ephemeral-instances-bot bot Mar 5, 2024
@grafana grafana deleted a comment from ephemeral-instances-bot bot Mar 5, 2024
@grafana grafana deleted a comment from ephemeral-instances-bot bot Mar 5, 2024
@derek-cadzow
Copy link

@joshhunt are there doc changes needed for this or should we remove the docs label?

@joshhunt
Copy link
Contributor Author

joshhunt commented Mar 5, 2024

@derek-cadzow No. I believe it got auto-tagged with it due to the addition of the feature toggle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants