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

Fix z-index for table of content in mobile #1612

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
background: var(--g-color-base-background);
border: 1px dotted var(--g-color-line-misc);
padding: 0 3px;
z-index: 99;
z-index: 96;
display: inline-block;
width: fit-content;
position: absolute;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/MobileTocToggle/MobileTocToggle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
background: var(--g-color-base-background);
position: sticky;
top: 0;
z-index: 101;
z-index: 97;
}
10 changes: 9 additions & 1 deletion src/ui/components/Widgets/Chart/ChartWidgetWithProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,19 @@ export class ChartWrapper extends React.Component<ChartWrapperWithProviderProps>
{...this.props}
dataProvider={this.dataProvider}
ignoreUsedParams={true}
key="chart"
/>
);
}

if (isSelectorType(this.props)) {
return <ChartSelectorComponent {...this.props} dataProvider={this.dataProvider} />;
return (
<ChartSelectorComponent
{...this.props}
dataProvider={this.dataProvider}
key="selector"
/>
);
}

const props = this.props as ChartWidgetProviderPropsWithRefProps;
Expand All @@ -58,6 +65,7 @@ export class ChartWrapper extends React.Component<ChartWrapperWithProviderProps>
{...props}
dataProvider={this.dataProvider}
compactLoader={true}
key="widget"
/>
);
}
Expand Down
13 changes: 0 additions & 13 deletions src/ui/components/Widgets/Chart/hooks/useLoadingChartWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export const useLoadingChartWidget = (props: LoadingChartWidgetHookProps) => {

const [loadedDescription, setLoadedDescription] = React.useState<string | null>(null);
const [description, setDescription] = React.useState<string | null>(null);
const [scrollOffset, setScrollOffset] = React.useState<number | null>(null);
const [loadedWidgetType, setLoadedWidgetType] = React.useState<string>('');
const [isLoadedWidgetWizard, setIsLoadedWidgetWizard] = React.useState(false);
const [isRendered, setIsRendered] = React.useState(false);
Expand Down Expand Up @@ -301,10 +300,8 @@ export const useLoadingChartWidget = (props: LoadingChartWidgetHookProps) => {
const handleToggleFullscreenMode = React.useCallback(() => {
const searchParams = new URLSearchParams(history.location.search);
const isFullscreenNewMode = !searchParams.has(FOCUSED_WIDGET_PARAM_NAME);
const scrollHeight = isFullscreenNewMode ? window.scrollY : null;

if (isFullscreenNewMode) {
setScrollOffset(scrollHeight);
searchParams.set(FOCUSED_WIDGET_PARAM_NAME, widgetId);
} else {
searchParams.delete(FOCUSED_WIDGET_PARAM_NAME);
Expand Down Expand Up @@ -415,16 +412,6 @@ export const useLoadingChartWidget = (props: LoadingChartWidgetHookProps) => {
handleChartkitReflow();
}, [loadedDescription, description, handleChartkitReflow]);

/**
* updating window position on change fullscreen mode (for mob version)
*/
React.useLayoutEffect(() => {
if (!isFullscreen && scrollOffset !== null) {
window.scrollTo(0, scrollOffset || 0);
setScrollOffset(null);
}
}, [scrollOffset, isFullscreen]);

/**
* handle changed chart tab
*/
Expand Down
Loading