Dropdown + modal fix

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-08-20 10:23:30 +02:00
parent 812aaab83f
commit 236e4db1a9
3 changed files with 5 additions and 3 deletions

View File

@ -108,7 +108,7 @@ const DropdownMenu = (props: IDropdownMenu) => {
const { state } = history.location;
if (goBack && state && (state as any).soapboxDropdownKey && (state as any).soapboxDropdownKey === dropdownHistoryKey.current) {
history.goBack();
(history.location.state as any).soapboxDropdownKey = true;
(history.location.state as any).soapboxDropdownKey = undefined;
}
closeDropdownMenu();

View File

@ -150,7 +150,9 @@ const ModalRoot: React.FC<IModalRoot> = ({ children, onCancel, onClose, type })
const handleModalOpen = () => {
modalHistoryKey.current = Date.now();
unlistenHistory.current = history.listen(({ state }, action) => {
if (!(state as any)?.soapboxModalKey) {
if ((state as any)?.soapboxDropdownKey) {
return;
} else if (!(state as any)?.soapboxModalKey) {
onClose();
} else if (action === 'POP') {
handleOnClose();