Multi-tenant: the assign-tenant modal opens behind a nested drawer and takes its focus
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 40/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- nextjs, react, typescript
- Domain
- frontend
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
pnpm dev, open/admin, and create the first user with passwordlongenough1.- Create two tenants,
AcmeandBeta. - Create a page with Acme as its Featured Tenant.
- On the Pages list, clear "Filter by Tenant" in the sidebar.
- Open the page, then open Acme with the edit icon in Featured Tenant.
- In Acme's drawer, choose Create New under Image.
- 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
- Dominant language
- TypeScript
- Stars
- 45.8k
- Forks
- 4.4k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 251
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from payloadcms/payload
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keysPossibly taken @pcbeingused333 claimed this today. OpenBug db: d1-sqlite Payload OSS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19766 ·
Maintainers usually reply within 1 day
-
Document bar (.doc-controls__content) overflows a 375 px viewport, clips "Created" and fails axe scrollable-region-focusablePossibly taken A pull request linked to this issue is open or already merged. Openarea: ui Bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
payloadcms/payload#19690 ·
Maintainers usually reply within 1 day
-
[v4] Blocks thumbnails croped 3:2Possibly taken @samiarif02 claimed this 2 days ago. Openarea: ui Bug Payload OSS status: needs-triage v3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
payloadcms/payload#19609 ·
Maintainers usually reply within 1 day
-
Scheduled publish jobs are not deleted when their document is deleted (string id in the job, raw id in the cleanup)Possibly taken @volodymyrshk claimed this 10 days ago. Openarea: core Bug db: sqlite
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19448 ·
Maintainers usually reply within 1 day
-
plugin-multi-tenant: `isGlobal` collections redirect tenant-scoped users to `/admin` since 3.93.0 (GlobalViewRedirect prop-name mismatch)Possibly taken @JarrodMFlesch claimed this 10 days ago. OpenBug plugin: multi-tenant
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#19420 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in payloadcms/payload
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
milind-soni/OpenMausBot#6730 ·
Maintainers usually reply within 1 day
-
`@angular/[email protected]` depends on vulnerable Vite 7.3.7 - GHSA-p4f5-76q4-ffq7 (Critical RCE)Openarea: @angular/build
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
angular/angular-cli#34764 ·
Maintainers usually reply within 1 day
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30384 · 1 comment ·
Maintainers usually reply within 1 day
-
P2
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
area:image documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day