Skip to content

fix(theme/NavScreen): Disable clicks on active language/version entries in mobile nav#2883

Merged
SoonIter merged 2 commits intomainfrom
copilot/fix-nav-screen-clickability
Dec 12, 2025
Merged

fix(theme/NavScreen): Disable clicks on active language/version entries in mobile nav#2883
SoonIter merged 2 commits intomainfrom
copilot/fix-nav-screen-clickability

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 12, 2025

Summary

NavScreen language and version menus allowed the active entry to be clicked, causing pointless navigation. Active items now render as non-interactive elements with disabled styling while keeping other options clickable.

  • Behavior: Render active language/version as spans with aria-current="page" and aria-disabled.
  • Styling: Add disabled state class to prevent pointer events and dim text.
  • Accessibility: Use semantic aria attributes for active entries.

Example:

const isActive = item.text === activeValue;
return isActive ? (
  <span className={className} aria-current="page" aria-disabled={true}>
    {item.text}
  </span>
) : (
  <Link href={item.link} className={className}>
    {item.text}
  </Link>
);

Related Issue

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
Original prompt

修一个 bug

NavScreenLangs 和 NavScreenVersions 中,如果 active 了,就不可被点击

如果当前页面是 English,选项中同时有 English 和中文,则 English 无法被点击


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@netlify
Copy link
Copy Markdown

netlify Bot commented Dec 12, 2025

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit d6ffdbe
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/693bdd10f03e860008a49a6b
😎 Deploy Preview https://deploy-preview-2883--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix nav screen clickability for active languages Disable clicks on active language/version entries in mobile nav Dec 12, 2025
Copilot AI requested a review from SoonIter December 12, 2025 09:16
@github-actions
Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

📁 web

Path: website/doc_build/web/rsdoctor-data.json

📌 Baseline Commit: b76eeb0bb9 | PR: #2879

Metric Current Baseline Change
📊 Total Size 14.7 MB 14.7 MB 572.0 B (0.0%)
📄 JavaScript 14.1 MB 14.1 MB 367.0 B (0.0%)
🎨 CSS 114.2 KB 114.0 KB 205.0 B (0.2%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 514.9 KB 514.9 KB 0 B (0.0%)

📦 Download Diff Report: web Bundle Diff

Generated by Rsdoctor GitHub Action

@SoonIter SoonIter changed the title Disable clicks on active language/version entries in mobile nav fix(theme/NavScreen): Disable clicks on active language/version entries in mobile nav Dec 12, 2025
@SoonIter SoonIter marked this pull request as ready for review December 12, 2025 09:45
Copilot AI review requested due to automatic review settings December 12, 2025 09:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where active language and version entries in the mobile navigation menu could be clicked, causing unnecessary navigation to the same page. The fix renders active entries as non-interactive span elements with appropriate styling while maintaining the clickable Link elements for other options.

  • Conditionally renders active items as <span> elements instead of <Link> components
  • Adds disabled styling (dimmed text, default cursor, no pointer events) for active entries
  • Implements semantic aria-current="page" attribute to indicate the current selection

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
NavScreenVersions.tsx Added logic to detect active version and render it as a non-clickable span with aria attributes
NavScreenVersions.scss Added styles for active version items including dimmed text color and disabled pointer events
NavScreenLangs.tsx Added logic to detect active language and render it as a non-clickable span with aria attributes
NavScreenLangs.scss Added styles for active language items including dimmed text color and disabled pointer events

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/src/theme/components/NavScreen/NavScreenVersions.tsx
Comment thread packages/core/src/theme/components/NavScreen/NavScreenLangs.tsx
@SoonIter SoonIter merged commit 29ba105 into main Dec 12, 2025
17 of 18 checks passed
@SoonIter SoonIter deleted the copilot/fix-nav-screen-clickability branch December 12, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants