Skip to content

fix(client): hide goto dialog suggestions when dialog is closed#2597

Merged
kermanx merged 1 commit into
slidevjs:mainfrom
SkorbezhArtem:fix/goto-dialog-stale-suggestions
May 17, 2026
Merged

fix(client): hide goto dialog suggestions when dialog is closed#2597
kermanx merged 1 commit into
slidevjs:mainfrom
SkorbezhArtem:fix/goto-dialog-stale-suggestions

Conversation

@SkorbezhArtem
Copy link
Copy Markdown
Contributor

Summary

Hide the goto dialog's autocomplete suggestions list when the dialog itself is in its closed state, so the list cannot leak into the viewport while the dialog wrapper is offscreen.

Fixes #2593

Background

The dialog wrapper toggles between top-5 and -top-20 based on showGotoDialog. The wrapper has no height constraint and no overflow: hidden, so its content can extend back into the viewport. The autocomplete list inside the wrapper renders whenever result.length > 0, which depends on text - independently of the dialog's own open/closed state.

If those two pieces of state ever drift (the dialog flips to closed while text still has content), the list keeps rendering and the wrapper grows tall enough that the list spills below the -top-20 offset, exactly as observed in #2593 (#slidev-goto-dialog.-top-20 with height ~666px and an .autocomplete-list still mounted).

Fix

Add showGotoDialog to the list's v-if so the autocomplete list only renders while the dialog is in its open state. The list visibility now depends tautologically on the dialog's state — there's no path where the wrapper is in its closed position and the list is still mounted.

Test plan

  • pnpm eslint packages/client/internals/Goto.vue --cache — clean.
  • pnpm exec vue-tsc --noEmit --skipLibCheck — no diagnostics in packages/client (preexisting unrelated diagnostics in docs/node_modules/vitepress only).
  • pnpm -C demo/starter run build — clean.
  • Manual verification in pnpm demo:dev:
    • press g, type a query → suggestions list appears as expected;
    • close the dialog → wrapper slides to top: -80px and the list is unmounted (previously remained rendered below the offset whenever text was non-empty at close-time);
    • reopen the dialog with g → text and selection are reset by the existing watcher, list hidden until a new query is typed.
  • Reproduced the buggy state by temporarily skipping the text reset in close(): with the previous v-if="result.length > 0" the wrapper got -top-20 while .autocomplete-list stayed mounted (matching the issue's DOM snapshot); with the new v-if it does not.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 14, 2026

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit 73ce3e4
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6a05111aa791ec00086f25be
😎 Deploy Preview https://deploy-preview-2597--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 17, 2026

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/@slidev/client@2597

create-slidev

npm i https://pkg.pr.new/create-slidev@2597

create-slidev-theme

npm i https://pkg.pr.new/create-slidev-theme@2597

@slidev/parser

npm i https://pkg.pr.new/@slidev/parser@2597

@slidev/cli

npm i https://pkg.pr.new/@slidev/cli@2597

@slidev/types

npm i https://pkg.pr.new/@slidev/types@2597

commit: 73ce3e4

@kermanx kermanx merged commit 46bcec2 into slidevjs:main May 17, 2026
20 checks passed
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

Successfully merging this pull request may close these issues.

Goto suggestions remain visible when dialog is closed in Slidev 51

2 participants