fix: keep translation links in the current tab#5158
Open
lilianakatrina684-a11y wants to merge 1 commit intovuejs:mainfrom
Open
fix: keep translation links in the current tab#5158lilianakatrina684-a11y wants to merge 1 commit intovuejs:mainfrom
lilianakatrina684-a11y wants to merge 1 commit intovuejs:mainfrom
Conversation
4 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the default theme’s link handling so translation menu links can opt out of “external link” behavior (new tab + external icon), keeping localized docs navigation in the current tab.
Changes:
- Added
isLinkExternal()utility to allow explicit override of external-link detection. - Extended
VPLinkwith anexternal?: booleanprop and routed external detection through the new utility. - Updated translation menu components to force
external=false, and added unit tests for the override logic.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/client/theme-default/support/utils.ts | Adds isLinkExternal() helper with optional override behavior. |
| src/client/theme-default/components/VPLink.vue | Introduces external prop and uses isLinkExternal() for external-link behavior. |
| src/client/theme-default/components/VPNavBarTranslations.vue | Forces translation menu links to stay in-tab by passing external=false. |
| src/client/theme-default/components/VPNavScreenTranslations.vue | Forces in-tab navigation for mobile translations and adds hreflang/rel="alternate". |
| tests/unit/client/theme-default/support/utils.test.ts | Adds unit coverage for the new external override logic. |
Comments suppressed due to low confidence (1)
src/client/theme-default/components/VPNavBarTranslations.vue:29
VPNavBarExtra.vuealso renders the translations flyout between 768px and 1279px, but it still uses the default external-link handling (so translation links may continue to open in a new tab at those breakpoints). To fully keep translation links in the current tab across all navbar variants, apply the sameexternal=falseoverride to the translation links inVPNavBarExtra.vueas well.
<template v-for="locale in localeLinks" :key="locale.link">
<VPMenuLink
:item="locale"
:external="false"
:lang="locale.lang"
:hreflang="locale.lang"
rel="alternate"
:dir="locale.dir"
/>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
update it here too - (toggle copilot's low confidence comment for details) |
15a0278 to
09af6c7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VPLink