Skip to content

Conversation

@svennergr
Copy link
Contributor

What is this feature?

Previously the ExtensionSidebar was rendering below the toolbars. Especially in Dashboards and Explore that created a bad UX where toolbar buttons where too far away from the content it belongs to:

image

This PR moves the ExtensionSidebar next to the toolbar, if it has two header levels:
image

@svennergr svennergr requested a review from a team as a code owner November 4, 2025 14:08
@svennergr svennergr added no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Nov 4, 2025
@github-actions github-actions bot added this to the 12.3.x milestone Nov 4, 2025
@svennergr svennergr requested a review from torkelo November 4, 2025 14:09
@svennergr svennergr requested a review from a team November 4, 2025 14:14
@torkelo torkelo requested a review from ashharrison90 November 4, 2025 14:14
Copy link
Contributor

@ivanahuckova ivanahuckova left a comment

Choose a reason for hiding this comment

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

Works like a charm! ✨ I've left some questions/suggestions bellow.

}

const getStyles = (theme: GrafanaTheme2) => {
const getStyles = (theme: GrafanaTheme2, extensionSidebarWidth = 0) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const getStyles = (theme: GrafanaTheme2, extensionSidebarWidth = 0) => {
const getStyles = (theme: GrafanaTheme2, extensionSidebarWidth: number) => {

const headerLevels = useChromeHeaderLevels();
const headerHeight = headerLevels * getChromeHeaderLevelHeight();
const styles = useStyles2(getStyles, headerHeight);
const sidebarTop = headerLevels === 2 ? getChromeHeaderLevelHeight() : headerHeight;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have an example of when we have more than 2 headers? Because with 1 or 2 headers, the sidebarTop is always 40. So I want to test it when we have more than 2 headers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar to the other comment, this was not needed in the end. But to answer your question: useChromeHeaderLevels() will only return 0, 1 or 2

[styles.content]: true,
[styles.contentChromeless]: state.chromeless,
[styles.contentWithSidebar]: isExtensionSidebarOpen && !state.chromeless,
[styles.contentWithSidebar]: isExtensionSidebarOpen && !state.chromeless && headerLevels !== 2,
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure what does headerLevels !== 2 do here and couple lines bellow. Also what do you think about extracting headerLevels === 2 into variable that has meaningful name for its purpose and using it everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting this Ivana. Actually this introduced a regression with the position of scrollbars. I was able to just remove it from here.

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

Labels

area/frontend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants