Skip to content

Drawer cannot be reopened after closing with escape #4100

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

Open
1 of 7 tasks
schneisn opened this issue Apr 23, 2025 · 0 comments
Open
1 of 7 tasks

Drawer cannot be reopened after closing with escape #4100

schneisn opened this issue Apr 23, 2025 · 0 comments

Comments

@schneisn
Copy link

schneisn commented Apr 23, 2025

Which generators are impacted?

  • All
  • HTML
  • React
  • Angular
  • Vue
  • Web components
  • Power Apps

Reproduction case

When having the following component, the close event listener of the drawer is not triggered because the focus of the activeElement is not on the drawer, but on the body element.
That also leads to the drawer being closed but it cannot be opened anymore.

<script setup lang="ts">
import { DBButton, DBDrawer } from '@db-ux/v-core-components';
import { ref } from 'vue';

const isButtonVisible = ref(true);

const onClose = () => {
  alert('CLOSE DRAWER');
};
</script>

<template>
  <DBDrawer :open="true" direction="down" width="auto" @close="onClose">
    <template #drawer-header>
      <span>TEST</span>
    </template>
    <div class="nemo-drawer-content">
      <DBButton v-if="isButtonVisible" @click="isButtonVisible = false"> A button </DBButton>
    </div>
  </DBDrawer>
</template>

Steps to reproduce:

  1. When the drawer is open, press the escape key. The close event listener is triggered and an alert is displayed (That is the correct behavior).
  2. Close the alert.
  3. Click on the button with the text "A button". The button disappears which leads to the focus of the active element being on the body, not the drawer anymore.

Image

  1. Press the escape key. The close event listener and the onClose method is not called because the activeElement is the html body Element, not the Drawer. The drawer is closed but cannot be opened anymore.

Potentially related to #3412

Expected Behaviour

The focus should always stay in the drawer as long as the drawer is open and the close event listener is triggered when pressing the escape key.

Screenshots

No response

Browser version

None

Add any other context about the problem here.

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant