Skip to content

Conversation

J-Sek
Copy link
Contributor

@J-Sek J-Sek commented Sep 22, 2025

  • extends the selector for focusable elements
  • verifies that elements are actually rendered

fixes #18400

TODO:

  • verify collapsed <details>
  • include [contenteditable]:not([contenteditable="false"]) for VEditor or any RichText editor
  • include audio[controls] and video[controls]

Note: with the current approach (keydown), video/audio controls are not fully accessible. We should revisit #22101 and maybe set some invisible element before and after the dialog content so we don't rely on focusable items detection.

Markup:

<template>
  <v-app theme="dark">
    <v-container>
      <v-row>
        <v-col>
          <v-dialog width="500">
            <template #activator="{ props }">
              <v-btn v-bind="props" text="Open Dialog" />
            </template>

            <template #default="{ isActive }">
              <v-card title="Dialog">
                <v-card-text>
                  Content goes here...

                  <v-text-field style="display: none" />
                  <v-text-field style="position: fixed" />
                  <v-text-field inert />
                </v-card-text>

                <v-card-actions>
                  <v-spacer />

                  <v-btn text="Close" @click="isActive.value = false" />
                  <v-btn text="Save" @click="isActive.value = false" />
                </v-card-actions>
                <v-text-field inert />
                <div contenteditable>
                  <p>Edit me</p>
                </div>
                <div contenteditable="false">
                  <p>Edit disabled</p>
                </div>
                <video max-width="450" src="https://cdn.jsek.work/cdn/vt-sunflowers.mp4" controls muted />
                <audio src="https://cdn.jsek.work/cdn/vt-sunflowers.mp4" controls />
                <details>
                  <summary>Expandable</summary>
                  Hidden content<v-btn text="I am only focusable if section is expanded" />
                </details>
              </v-card>
            </template>
          </v-dialog>
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</template>

@J-Sek J-Sek self-assigned this Sep 22, 2025
@J-Sek J-Sek added T: bug Functionality that does not work as intended/expected C: VDialog E: focus labels Sep 22, 2025
@KaelWD KaelWD marked this pull request as draft September 24, 2025 08:37
@J-Sek J-Sek modified the milestone: v3.10.x Oct 17, 2025
@J-Sek J-Sek force-pushed the fix/vdialog--focus-trap branch 2 times, most recently from d9317bf to 1b0cedc Compare October 18, 2025 18:15
@J-Sek J-Sek marked this pull request as ready for review October 18, 2025 18:18
@J-Sek J-Sek force-pushed the fix/vdialog--focus-trap branch from 1b0cedc to 52f0f4b Compare October 18, 2025 18:19
@J-Sek J-Sek merged commit adf3f91 into vuetifyjs:master Oct 18, 2025
10 checks passed
@J-Sek J-Sek deleted the fix/vdialog--focus-trap branch October 18, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C: VDialog E: focus T: bug Functionality that does not work as intended/expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report][3.3.20] VDialog focus trap is broken by display: none inputs

1 participant