Skip to content

Commit f083a09

Browse files
committed
fix: Always keep the Viewer modal behind the others
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.
1 parent 47c0dc7 commit f083a09

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/components/Viewer/FilesViewer.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ const styleStatusBar = switcher => {
2121
}
2222
}
2323

24+
// Keep the Dialog behind the others Dialogs
25+
const viewerStyle = { zIndex: 'calc(var(--zIndex-modal) - 1)' }
26+
2427
const FilesViewer = ({ filesQuery, files, fileId, onClose, onChange }) => {
2528
const [currentFile, setCurrentFile] = useState(null)
2629
const [fetchingMore, setFetchingMore] = useState(false)
@@ -122,6 +125,12 @@ const FilesViewer = ({ filesQuery, files, fileId, onClose, onChange }) => {
122125

123126
return (
124127
<Viewer
128+
componentsProps={{
129+
modalProps: {
130+
open: true,
131+
style: viewerStyle
132+
}
133+
}}
125134
files={viewerFiles}
126135
currentIndex={viewerIndex}
127136
onChangeRequest={handleOnChange}

src/components/Views/InformationEdit.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ import Spinner from 'cozy-ui/transpiled/react/Spinner'
2323
import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints'
2424
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n'
2525

26-
// Keep the Dialog above the Viewer
27-
const fixedDialogStyle = { zIndex: 'var(--zIndex-modal-footer)' }
28-
2926
const InformationEdit = () => {
3027
const { fileId } = useParams()
3128
const client = useClient()
@@ -112,7 +109,6 @@ const InformationEdit = () => {
112109
<FixedDialog
113110
open
114111
onClose={onClose}
115-
style={fixedDialogStyle}
116112
title={dialogTitle}
117113
content={
118114
<div

0 commit comments

Comments
 (0)