mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Backport pull request #6450 from jellyfin-web/release-10.10.z
Fix menu closing when expanding section
Original-merge: 8710de09d4
Merged-by: thornbill <thornbill@users.noreply.github.com>
Backported-by: thornbill <thornbill@users.noreply.github.com>
This commit is contained in:
parent
bcae4477b4
commit
84157e74f5
1 changed files with 7 additions and 3 deletions
|
@ -7,7 +7,7 @@ import ListItemButton from '@mui/material/ListItemButton/ListItemButton';
|
||||||
import ListItemIcon from '@mui/material/ListItemIcon';
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
||||||
import ListItemText from '@mui/material/ListItemText';
|
import ListItemText from '@mui/material/ListItemText';
|
||||||
import ListSubheader from '@mui/material/ListSubheader';
|
import ListSubheader from '@mui/material/ListSubheader';
|
||||||
import React, { useCallback, useState } from 'react';
|
import React, { type MouseEvent, useCallback, useState } from 'react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
import ListItemLink from 'components/ListItemLink';
|
import ListItemLink from 'components/ListItemLink';
|
||||||
|
@ -33,11 +33,15 @@ const ServerDrawerSection = () => {
|
||||||
const [ isLibrarySectionOpen, setIsLibrarySectionOpen ] = useState(LIBRARY_PATHS.includes(location.pathname));
|
const [ isLibrarySectionOpen, setIsLibrarySectionOpen ] = useState(LIBRARY_PATHS.includes(location.pathname));
|
||||||
const [ isPlaybackSectionOpen, setIsPlaybackSectionOpen ] = useState(PLAYBACK_PATHS.includes(location.pathname));
|
const [ isPlaybackSectionOpen, setIsPlaybackSectionOpen ] = useState(PLAYBACK_PATHS.includes(location.pathname));
|
||||||
|
|
||||||
const onLibrarySectionClick = useCallback(() => {
|
const onLibrarySectionClick = useCallback((e: MouseEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
setIsLibrarySectionOpen(isOpen => !isOpen);
|
setIsLibrarySectionOpen(isOpen => !isOpen);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const onPlaybackSectionClick = useCallback(() => {
|
const onPlaybackSectionClick = useCallback((e: MouseEvent) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
setIsPlaybackSectionOpen(isOpen => !isOpen);
|
setIsPlaybackSectionOpen(isOpen => !isOpen);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue