Skip to content

fix(theme): close outline dropdown when link text is clicked - #5545

Open
giteshchaudhari681-art wants to merge 2 commits into
vuejs:mainfrom
giteshchaudhari681-art:fix/your-selected-issue
Open

giteshchaudhari681-art wants to merge 2 commits into
vuejs:mainfrom
giteshchaudhari681-art:fix/your-selected-issue

Conversation

@giteshchaudhari681-art

Copy link
Copy Markdown

Description

In VPLocalNavOutlineDropdown.vue, the click handler previously checked (e.target as HTMLElement).classList.contains('outline-link').

In VPDocOutlineItem.vue, the heading title text is wrapped in <bdi> elements:

<a class="outline-link" :href="link" :title>
  <bdi>{{ title }}</bdi>
</a>

When a user clicks directly on the heading text inside an outline link, e.target is the nested <bdi> element (which does not have .outline-link), preventing open.value = false from executing and leaving the dropdown open.

This PR resolves the issue by using (e.target as HTMLElement).closest('.outline-link') so that clicks on nested elements correctly close the outline dropdown.

Commits

  1. test: reproduce outline dropdown click issue — Focused end-to-end regression test in __tests__/e2e/navigation.test.ts.
  2. fix(theme): close outline dropdown when link text is clicked — Minimal 1-line production fix in VPLocalNavOutlineDropdown.vue.

Linked Issues

Fixes #5533

Additional Context

  • Passes full validation: e2e test suite (pnpm -F=tests-e2e test navigation.test.ts), unit tests (pnpm test:unit), and typechecks (pnpm typecheck).

This branch has not been deployed

No deployments
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.

Local navigation outline dropdown does not reliably close after selecting a heading

1 participant