Skip to content

feat: add keyboard shortcuts for package links (g/h/i/n)#2912

Open
akadotsh wants to merge 1 commit into
npmx-dev:mainfrom
akadotsh:feat/package-link-shortcuts
Open

feat: add keyboard shortcuts for package links (g/h/i/n)#2912
akadotsh wants to merge 1 commit into
npmx-dev:mainfrom
akadotsh:feat/package-link-shortcuts

Conversation

@akadotsh

Copy link
Copy Markdown
Contributor

🔗 Linked issue

Closes #2900

🧭 Context

📚 Description

Added keyboard shortcuts for GitHub (g), homepage (h), issues (i), and npm (n) links. These shortcuts open the respective links in a new tab.

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs.npmx.dev Ready Ready Preview, Comment Jun 14, 2026 6:02pm
npmx.dev Ready Ready Preview, Comment Jun 14, 2026 6:02pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Jun 14, 2026 6:02pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f227edec-3695-41ef-b088-df311f280417

📥 Commits

Reviewing files that changed from the base of the PR and between 604dc92 and c58f364.

📒 Files selected for processing (6)
  • app/components/AppFooter.vue
  • app/components/Package/ExternalLinks.vue
  • app/composables/useShortcuts.ts
  • docs/content/2.guide/2.keyboard-shortcuts.md
  • i18n/locales/en.json
  • i18n/schema.json

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Added keyboard shortcuts for opening package repository, homepage, issues, and npm page via keys g, h, i, and n respectively.
    • External links now open correctly in new tabs with enhanced security attributes.
  • Documentation

    • Updated keyboard shortcuts guide with new package page bindings and descriptions.

Walkthrough

useShortcuts is extended to detect external URLs and open them in a new tab with noopener/noreferrer. The ExternalLinks.vue component registers g, h, i, and n shortcuts for repository, homepage, issues, and npm links, with matching aria-keyshortcuts attributes. The i18n schema, translations, footer modal, and docs are updated accordingly.

Changes

External Link Keyboard Shortcuts

Layer / File(s) Summary
useShortcuts external URL detection and navigation
app/composables/useShortcuts.ts
Adds IS_EXTERNAL_URL_RE and isExternalUrl type guard; navigation branches to open external URLs in a new tab (_blank) with noopener/noreferrer via navigateTo, falling back to internal navigation for non-external targets.
i18n schema and translations
i18n/schema.json, i18n/locales/en.json
Extends the shortcuts.section schema with open_repo, open_homepage, open_issues, and open_npm string properties, and adds their English translation values alongside the existing open_stats entry.
ExternalLinks shortcut registration and ARIA attributes
app/components/Package/ExternalLinks.vue
Registers g/h/i/n shortcuts via useShortcuts mapped to computed external URLs; adds aria-keyshortcuts attributes to the repository, homepage, issues, and npm LinkBase elements.
Footer modal entries and keyboard shortcuts docs
app/components/AppFooter.vue, docs/content/2.guide/2.keyboard-shortcuts.md
Adds g, h, i, and n list items to the AppFooter shortcuts modal and corresponding table rows to the keyboard-shortcuts guide.

Possibly related PRs

  • npmx-dev/npmx.dev#2872: Modifies the same AppFooter.vue shortcuts modal and the useShortcuts composable to add the s key for opening stats, touching the same code paths extended by this PR.

Suggested reviewers

  • graphieros
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding keyboard shortcuts for package links (g/h/i/n), which is the primary focus of the changeset.
Description check ✅ Passed The description relates directly to the changeset, explaining that keyboard shortcuts for GitHub (g), homepage (h), issues (i), and npm (n) links have been added to open in new tabs.
Linked Issues check ✅ Passed The pull request successfully implements all coding requirements from issue #2900: keyboard shortcuts for g (GitHub/repository), h (homepage), i (issues), and n (npm) links that open in new tabs.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the keyboard shortcuts feature. Updates to AppFooter modal, ExternalLinks component, useShortcuts composable, documentation, and i18n files align with the feature scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
i18n/locales/en.json Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 8 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/components/Package/ExternalLinks.vue 20.00% 4 Missing ⚠️
app/composables/useShortcuts.ts 20.00% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

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.

Add keyboard shortcuts for github+homepage+issues+npm links

1 participant