Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Select] Incorrect z-index of select within modal #2347

Closed
EvertonWingert opened this issue Oct 9, 2024 · 6 comments
Closed

[Select] Incorrect z-index of select within modal #2347

EvertonWingert opened this issue Oct 9, 2024 · 6 comments
Labels
bug Something isn't working v3 #1289

Comments

@EvertonWingert
Copy link
Contributor

Environment

  • Operating System: Windows_NT
  • Node Version: v20.16.0
  • Nuxt Version: 3.13.2
  • CLI Version: 3.14.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Version

3.0.0-alpha.5

Reproduction

https://github.com/EvertonWingert/nuxtui-modal-select-issue

Description

When using a select inside a modal(slideover, drawer), the options list is rendered behind the modal content. This appears to be a z-index issue where the dropdown is not properly layered above the modal.
Image

Additional context

<template>
  <UModal title="Modal with description" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit.">
    <UButton label="Open" />

    <template #body>
      <USelectMenu v-model="value" :items="items" />
    </template>
  </UModal>
</template>
<script setup lang="ts">
const items = ref(['Backlog', 'Todo', 'In Progress', 'Done'])
const value = ref('Backlog')
</script>

Logs

No response

@EvertonWingert EvertonWingert added bug Something isn't working triage v3 #1289 labels Oct 9, 2024
@Davounet
Copy link

Davounet commented Oct 9, 2024

I am having the same issue. It is tricky to fix, because since everything is teleported at the body root we can't use the stacking contexts.

@EvertonWingert
Copy link
Contributor Author

I managed to fix it using the following configuration

ui: {
	select: {
		slots: {
			content: 'z-50'
		}
	},
	selectMenu: {
		slots: {
			content: 'z-50'
		}
	}
}

Copy link
Member

Since the SelectMenu is in Modal which is portaled to the body, you might want to set :portal="false" on the SelectMenu.

@benjamincanac benjamincanac removed the triage label Oct 10, 2024 — with Volta.net
Copy link
Member

Closing for now, feel free to reopen if it didn't solve!

@EvertonWingert
Copy link
Contributor Author

Using :portal="false" didn't work here (the items don't even appear anywhere on the screen when activated), I'll leave it closed because I can solve it by adding z-50 to (select, selectMenu)

@benjamincanac benjamincanac reopened this Oct 10, 2024
Copy link
Member

Adding z-50 to the content does fix the issue but it's a bit tedious. I think the solution here is to remove the z-index from the modal, I just tried and it seems to be useless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v3 #1289
Projects
None yet
Development

No branches or pull requests

3 participants