Skip to content

Commit

Permalink
fix: Always keep the Viewer modal behind the others
Browse files Browse the repository at this point in the history
We had recently encountered the same z-index problem,
but the correction brought this regression.
A more global fix for cozy-viewer may be in order in the future.
  • Loading branch information
Merkur39 committed Oct 25, 2024
1 parent 47c0dc7 commit f083a09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/components/Viewer/FilesViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const styleStatusBar = switcher => {
}
}

// Keep the Dialog behind the others Dialogs
const viewerStyle = { zIndex: 'calc(var(--zIndex-modal) - 1)' }

const FilesViewer = ({ filesQuery, files, fileId, onClose, onChange }) => {
const [currentFile, setCurrentFile] = useState(null)
const [fetchingMore, setFetchingMore] = useState(false)
Expand Down Expand Up @@ -122,6 +125,12 @@ const FilesViewer = ({ filesQuery, files, fileId, onClose, onChange }) => {

return (
<Viewer
componentsProps={{
modalProps: {
open: true,
style: viewerStyle
}
}}
files={viewerFiles}
currentIndex={viewerIndex}
onChangeRequest={handleOnChange}
Expand Down
4 changes: 0 additions & 4 deletions src/components/Views/InformationEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import Spinner from 'cozy-ui/transpiled/react/Spinner'
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'

// Keep the Dialog above the Viewer
const fixedDialogStyle = { zIndex: 'var(--zIndex-modal-footer)' }

const InformationEdit = () => {
const { fileId } = useParams()
const client = useClient()
Expand Down Expand Up @@ -112,7 +109,6 @@ const InformationEdit = () => {
<FixedDialog
open
onClose={onClose}
style={fixedDialogStyle}
title={dialogTitle}
content={
<div
Expand Down

0 comments on commit f083a09

Please sign in to comment.