Skip to content

several major issues with defineShortcuts() and modals/popovers, bubbling and such. #7430

Open

Description

@LMR-eitea

Environment

Operating system Linux 7.3.4-1-cachyos
Node.js version v26.13.1
nuxt/cli version 4.0.3
Package manager pnpm@12.5.1
Nuxt version 4.6.4
Nitro version 2.13.6
Builder vite@8.3.5
Config compatibilityDate, css, devtools, eslint, experimental, hooks, i18n, icon, modules, nitro, nodemailer, oidc, postcss, routeRules, runtimeConfig, ssr, vite
Modules @nuxt/eslint@1.17.0, @nuxt/ui@4.12.0, @eitea/lmrui@0.0.7, nuxt-nodemailer@1.1.4, nuxt-email-renderer@3.0.0, nuxt-oidc-auth@1.0.0-beta.13, @nuxtjs/i18n@10.6.0

Is this bug related to Nuxt or Vue?

Nuxt

Package

v4.x

Version

v4.6.4

Reproduction

https://play.ui.nuxt.com/#eNp1UjuO2zAQvcpbpfAuYFmAS0M2sNkqRYIAwXZqKGlkMSuRhEjZMAy3aYN0aYJcI+fJBZIjZKiPbRlZqZCG897M45s5Bo/GLHYtBasgtlkjjYMl1xpUQm3XSeBsEmwSJWujG4cjGipwQtHoGjOmzRKVaWUdDNEL1j59X4jK0sN1YnmTyamQij6VXDJrnb0/JgrIV7h/wHrTMRY7UbXEtLtLNPeoKALZTBi6Ri+n8CEc8b+/fAMpkVYEV0oLoXJIh62QysI0lFFOKiPoHTWMINQ6Z6Ez6L0amsEOWhN1Yv1x1FvFxnDgqDaVcMQREBvsQlmwc14Je+c/ItU6jsx/AEtGsDB+yrLE35/ff/z59fUMfX7vlXT/iYuf37bOacWTSalivjakeq1JEHUgpoxi8CbV+WE45fO7MEQYDrEv9lGb7sKrXNpaWitZBhftRtSNvCe+1tf09Evnm+48fEfKOzQmexHXMVCLQ0poVUOelSNtXT+joTz2sqpAwo1z4HFZS3bBxrvLq7SDVtUB+5KlFTprLeVz0I6j7uhzy5vodd8Q3xV+4A3NLKyuiVurbc/v1kWqPj33+5JSxhBeH7zQIdWiyeEaYbji5T5nh0frnhg28cBP9cbPg26RCYVS5tQ5MBzMxltPTe5qWCPUBuEZ/vT4AdZ5szqHkC94Rz1m4n90qyeOJss7gIbVGFdqiuH8uJVXmeD0D0Q2Zso=

Description

In my opinion, the current way that defineShortcuts() handles bubbling is extremely error-prone.

  • shortcuts generally get bubbled through popups
  • precedence is unintuitive and unhelpful (root-level defineShortcut takes precedence over modals' own escape shortcut for example)
  • un-dismissable Popovers don't let escape through at all
    (but defining an escape key to close the parent modal would mess with other popups, as described)

Additional context

In my opinion, defineShortcuts absolutely needs the following to be useful:

  • some way to constrain them to keypress events from inside an arbitrary component - named inputs are not enough! (and that doesn't even always work, but I didn't debug that)
  • some way to ignore keypresses from inside other modals - probably best to have a per-shortcut parameter global which defaults to true for backwards compat.
  • un-dismissable Popovers should bubble their escape key (should probably also be configurable, so you can still force unescapable popups - I suggest changing the dismissible property to bool | 'bubble')
  • there should also be a way to programmatically bubble a keypress (by returning false or something) so programmers can choose to constrain a shortcut to arbitrary states without having to bother with the ref (which is a truly awful experience in my opinion)

Marked as a bug instead of a feature request because while the current behaviour could be useful in some situations (truly global shortcuts), it's so unintuitive in most situations that I consider it a bug.

Logs

Activity

  1. added
    triageAwaiting initial review and prioritization
    on Nov 17, 2026
  2. added theissue type on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageAwaiting initial review and prioritization

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions