fix(tradein): MapPicker через portal в document.body — z-index конфликт с SourcesProgress (#771) (#782)
Some checks failed
Deploy Trade-In / deploy (push) Blocked by required conditions
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / test (push) Has been skipped
Deploy Trade-In / build-backend (push) Has been skipped
Deploy Trade-In / build-frontend (push) Has been cancelled
Some checks failed
Deploy Trade-In / deploy (push) Blocked by required conditions
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / test (push) Has been skipped
Deploy Trade-In / build-backend (push) Has been skipped
Deploy Trade-In / build-frontend (push) Has been cancelled
Co-authored-by: bot-frontend <bot-frontend@gendsgn.local> Co-committed-by: bot-frontend <bot-frontend@gendsgn.local>
This commit is contained in:
parent
238f14a0d7
commit
fdbd6ed70d
1 changed files with 11 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
/* Выбор адреса на карте ЕКБ (Leaflet + OSM). Клик по дому → reverse-геокодинг. */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any -- интероп с CDN-библиотекой Leaflet */
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
|
||||
import { API_BASE_URL } from "@/lib/api";
|
||||
|
||||
|
|
@ -98,6 +99,11 @@ export function MapPicker({ onPick, onClose }: Props) {
|
|||
// тонкий hint «Точка дома по Яндексу», чтобы user понимал почему marker
|
||||
// переехал на пару метров от его клика.
|
||||
const [snapped, setSnapped] = useState(false);
|
||||
// Portal-mount guard (SSR-safe): document доступен только после монтирования.
|
||||
// Рендерим оверлей в document.body, чтобы position:fixed/z-index:1000 не были
|
||||
// заперты в stacking-context формы (#771: полоски SourcesProgress наезжали).
|
||||
const [mounted, setMounted] = useState(false);
|
||||
useEffect(() => setMounted(true), []);
|
||||
|
||||
useEffect(() => {
|
||||
let map: any = null;
|
||||
|
|
@ -212,7 +218,9 @@ export function MapPicker({ onPick, onClose }: Props) {
|
|||
}
|
||||
};
|
||||
|
||||
return (
|
||||
if (!mounted) return null;
|
||||
|
||||
return createPortal(
|
||||
<div
|
||||
onClick={onClose}
|
||||
style={{
|
||||
|
|
@ -316,6 +324,7 @@ export function MapPicker({ onPick, onClose }: Props) {
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
document.body,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue