Multi-tenant: the assign-tenant modal opens behind a nested drawer and takes its focus

Aperta
#19,559 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Sophran-fbj ci sta già lavorando.

Dal 14/11/2026.

  • #19600 di @Sophran-fbj — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
40/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nextjs, react, typescript
Ambito
frontend

Direzione di ricerca

Start in the multi-tenant plugin's AssignTenantFieldModal, where zIndex is computed from drawerZBase and useDrawerDepth imported from @payloadcms/ui/elements/Drawer. Compare that with how the admin's drawers get the same values from the main @payloadcms/ui entry, which the issue says doesn't export them. Reproduce with the linked repo: open a media drawer inside Acme's drawer and check whether the modal sits above it. Done means the modal shows above nested drawers, and the fix needs a decision on how the plugin should share the drawer depth context.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug Payload OSS plugin: multi-tenant status: needs-triage v3
Describe the Bug

When the user can access more than one tenant, none is selected, and a tenant-scoped document is created in a drawer inside another drawer, the assign-tenant modal opens underneath that drawer. It's hidden, but its focus trap still wins, so the drawer's fields can't be focused.

AssignTenantFieldModal sets zIndex: drawerZBase + useDrawerDepth(), importing both from @payloadcms/ui/elements/Drawer. That's a separate copy of the drawer module from the prebundled @payloadcms/ui entry the admin's drawers use, so its depth context is never provided and the modal is always at 101. A nested drawer is at 102. One drawer deep they tie at 101 and the modal shows, which is why it only breaks when nested. The main entry doesn't export useDrawerDepth or drawerZBase, so the plugin can't simply import them from there instead.

We've worked around this by forcing .assign-tenant-field-modal to z-index 200 with !important.

Related:

  • #14727 also leaves an invisible modal blocking the UI, but from missing visibility classes, not z-index
  • #10109 fixed the same kind of problem for the unpublish modal in drawers.
  • #17006 rewrote this modal for 4.0 so this is probably 3.x only
Link to the code that reproduces this issue

https://github.com/scottybrown/payload-repros/tree/repro/tenant-modal-behind-nested-drawer

Reproduction Steps

Copy .env.example to .env and point DATABASE_URL at an empty Postgres database.

The repro adds the multi-tenant plugin for media, a tenants collection with an image upload, and a pages collection with a featuredTenant relationship.

  1. pnpm dev, open /admin, and create the first user with password longenough1.
  2. Create two tenants, Acme and Beta.
  3. Create a page with Acme as its Featured Tenant.
  4. On the Pages list, clear "Filter by Tenant" in the sidebar.
  5. Open the page, then open Acme with the edit icon in Featured Tenant.
  6. In Acme's drawer, choose Create New under Image.
  7. Click Alt and type.

Expected: the assign-tenant modal shows above the media drawer, as it does one drawer deep (Create New under Image on Acme's own edit screen) ✅

Actual: the modal opens behind the media drawer (z-index 101 against 102). Alt can't be focused or typed in. Alt is required, so the new media can't be saved.

https://github.com/user-attachments/assets/a17dd531-e462-497b-b616-2d1cdf51bef3

Which area(s) are affected?

plugin: multi-tenant

Environment Info
Binaries:
  Node: 24.22.1
  npm: 11.19.1
  Yarn: N/A
  pnpm: 10.14.0
Relevant Packages:
  payload: 3.93.0
  next: 16.4.3
  @payloadcms/db-postgres: 3.93.0
  @payloadcms/drizzle: 3.93.0
  @payloadcms/graphql: 3.93.0
  @payloadcms/next/utilities: 3.93.0
  @payloadcms/plugin-multi-tenant: 3.93.0
  @payloadcms/richtext-lexical: 3.93.0
  @payloadcms/translations: 3.93.0
  @payloadcms/ui/shared: 3.93.0
  react: 19.2.6
  react-dom: 19.2.6
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 27.0.0: Tue Aug 11 21:06:24 PDT 2026; root:xnu-13432.1.9~1/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 11
Lingua principale
TypeScript
Stelle
45.8k
Fork
4.4k
Merge medio
2g 16h
PR unite (30g)
251

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di payloadcms/payload

Tutte le issue di payloadcms/payload

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.