Skip to content
Draft
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
4 changes: 3 additions & 1 deletion src/Components/I18nWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ export const I18nWidget = (props: I18nWidgetProps) => {
negativeText: <Text id="stay" />,
onNegativeFeedback: () => {
// Reset the select to show the current language instead of the just selected one.
setNewLanguage(savedLocale);
dismissModal();
},
onDismiss: () => {
setNewLanguage(savedLocale);
},
hasDismissButton: false,
backdropDismisses: false,
});
Expand Down
6 changes: 4 additions & 2 deletions src/Components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Fragment, ComponentChildren, JSX } from 'preact';
import { useState, useCallback, useMemo, useEffect, useRef, useLayoutEffect } from 'preact/hooks';
import { createPortal } from 'preact/compat';
import type { MergeExclusive } from 'type-fest';
import t from '../Utility/i18n';

Expand Down Expand Up @@ -68,7 +69,7 @@ export const useModal = (
const Modal = useCallback(() => {
if (!shown) return <Fragment />;

return (
return createPortal(
<div className={`modal${document.getElementsByClassName('modal').length > 0 ? ' no-animation' : ''}`}>
<div className="backdrop" onClick={() => options.backdropDismisses && dismiss()} role="presentation" />

Expand Down Expand Up @@ -109,7 +110,8 @@ export const useModal = (
))}
</div>
</div>
</div>
</div>,
document.body
);
}, [options, dismiss, children, shown]);

Expand Down