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

Command Palette appears behind virtual keyboard when inside Modal on mobile devices #2157

Open
Marfi333 opened this issue Sep 8, 2024 · 1 comment
Labels
bug Something isn't working triage

Comments

@Marfi333
Copy link

Marfi333 commented Sep 8, 2024

Environment

Version

v2.18.4

Reproduction

https://ui.nuxt.com/components/command-palette#usage

Description

On mobile devices, when the modal is positioned at the bottom of the screen, the Command Palette becomes obscured by the virtual keyboard. This issue occurs when the Command Palette contains fewer than 6 elements or none at all, making it completely inaccessible for users.

The issue can be reproduced on the official component page:
https://ui.nuxt.com/components/command-palette

Additional context

No response

Logs

No response

@Marfi333 Marfi333 added bug Something isn't working triage labels Sep 8, 2024
@Tragio
Copy link
Contributor

Tragio commented Sep 13, 2024

Hi @Marfi333 👋

This is an interesting one.

There is a VirtualKeyboard API that would allow us to do something like height: calc(100vh - env(keyboard-inset-height)) however that is only for Chrome, at the moment. Which is not suitable.

The other possible way would be using Visual Viewport API but then I think we are adding stuff that can bring trouble along the line, only for some small edge cases.

Perhaps by using min-h-0 lg:min-h-full you solve your use case 🤔

<script setup lang="ts">
const isOpen = ref(false)

const people = [
  { id: 1, label: 'Wade Cooper' },
  { id: 2, label: 'Arlene Mccoy' },
  { id: 3, label: 'Devon Webb' },
  { id: 4, label: 'Tom Cook' },
  { id: 5, label: 'Tanya Fox' },
  { id: 6, label: 'Hellen Schmidt' },
  { id: 7, label: 'Caroline Schultz' },
  { id: 8, label: 'Mason Heaney' },
  { id: 9, label: 'Claudie Smitham' },
  { id: 10, label: 'Emil Schaefer' },
]

const selected = ref([])
</script>

<template>
  <div>
    <UButton label="Open" @click="isOpen = true" />

    <UModal
      v-model="isOpen"
      :ui="{
        container: 'min-h-0 lg:min-h-full',
      }"
    >
      <UCommandPalette
        v-model="selected"
        multiple
        nullable
        :groups="[{ key: 'people', commands: people }]"
      />
    </UModal>
  </div>
</template>

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

No branches or pull requests

2 participants