Skip to content

Commit

Permalink
fix(editor): Modal on serlo.org by applying z-index only when not on …
Browse files Browse the repository at this point in the history
…serlo.org and on the content directly instead of the overlay
  • Loading branch information
CodingDive committed Dec 22, 2024
1 parent 9c6c86f commit 1920b17
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/editor/src/editor-ui/editor-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useIsSerlo } from '@editor/core/hooks/use-is-serlo'
import { cn } from '@editor/utils/cn'
import { faXmark } from '@fortawesome/free-solid-svg-icons'
import * as Dialog from '@radix-ui/react-dialog'
Expand Down Expand Up @@ -32,6 +33,7 @@ export function EditorModal({
}: EditorModalProps) {
const previouslyFocusedElementRef = useRef<HTMLElement | null>(null)

const isSerlo = useIsSerlo()
const onOpenChange = useCallback(
(open: boolean) => {
if (open !== false) {
Expand Down Expand Up @@ -70,7 +72,12 @@ export function EditorModal({
className={cn(defaultModalOverlayStyles, extraOverlayClassName)}
/>
<Dialog.Content
className={cn('serlo-modal', className)}
className={cn(
'serlo-modal',
className,
// The moodle navigation bar has a z-index of 1030...
isSerlo && 'z-[1040]'
)}
data-modal-state={isOpen ? 'open' : 'closed'}
aria-describedby={undefined}
onEscapeKeyDown={onEscapeKeyDown}
Expand Down Expand Up @@ -104,8 +111,6 @@ export function EditorModal({
)
}

// The moodle navigation bar has a z-index of 1030... We are using 1040 to make
// sure the modal can be on top and is not cut off
export const defaultModalOverlayStyles = cn(
'fixed bottom-0 left-0 right-0 top-0 z-[1040] bg-white bg-opacity-75'
'fixed bottom-0 left-0 right-0 top-0 z-[101] bg-white bg-opacity-75'
)

0 comments on commit 1920b17

Please sign in to comment.