Skip to content

fix: navbar Help menu links not opening in desktop app#980

Open
abhiraj75 wants to merge 6 commits intoCircuitVerse:mainfrom
abhiraj75:abhiraj_dev
Open

fix: navbar Help menu links not opening in desktop app#980
abhiraj75 wants to merge 6 commits intoCircuitVerse:mainfrom
abhiraj75:abhiraj_dev

Conversation

@abhiraj75
Copy link
Contributor

@abhiraj75 abhiraj75 commented Feb 25, 2026

Fixes #949

Describe the changes you have made in this PR -

The navbar Help menu items (User Manual, Learn Digital Logic, Discussion Forum) were not opening when clicked in the desktop app.

Added a [handleItemClick()] function in (cv-frontend-vue/src/components/Navbar/NavbarLinks/NavbarLink/NavbarLink2.vue) that detects external link items (those with href attributes) and opens them using Tauri's WebviewWindow API in the desktop app, with window.open() fallback for web builds. Non-link items (e.g., Tutorial Guide) continue using logixFunction as before. Also added core:webview:allow-create-webview-window capability permission .

Code Understanding and AI Usage

Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code?

  • No, I wrote all the code myself
  • Yes, I used AI assistance (continue below)

If you used AI assistance:

  • I have reviewed every single line of the AI-generated code
  • I can explain the purpose and logic of each function/component I added
  • I have tested edge cases and understand how the code handles them
  • I have modified the AI output to follow this project's coding standards and conventions

Explain your implementation approach:

Navbar Help dropdown items with external URLs (User Manual, Learn Digital Logic, Discussion Forum) had empty itemid, so logixFunction[""]() was called silently failing on click.


Checklist before requesting a review

  • I have added proper PR title and linked to the issue
  • I have performed a self-review of my code
  • I can explain the purpose of every function, class, and logic block I added
  • I understand why my changes work and have tested them thoroughly
  • I have considered potential edge cases and how my code handles them
  • If it is a core feature, I have added thorough tests
  • My code follows the project's style guidelines and conventions

Note: Please check Allow edits from maintainers if you would like us to assist in the PR.

Summary by CodeRabbit

  • New Features

    • App can open external HTTPS URLs using the native window opener when available, with a browser fallback; corresponding permission added.
  • Improvements

    • More robust handling of dynamic attributes for navigation links to avoid invalid attribute propagation.
  • Bug Fixes

    • Navigation components now remove related event listeners on unmount to prevent leaks.

@netlify
Copy link

netlify bot commented Feb 25, 2026

Deploy Preview for circuitverse ready!

Name Link
🔨 Latest commit 1294a84
🔍 Latest deploy log https://app.netlify.com/projects/circuitverse/deploys/69a12378de28c20008100d27
😎 Deploy Preview https://deploy-preview-980--circuitverse.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 35 (🔴 down 11 from production)
Accessibility: 66 (no change from production)
Best Practices: 92 (no change from production)
SEO: 82 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

Warning

Rate limit exceeded

@abhiraj75 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b759439 and 1294a84.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json

Walkthrough

Adds capability to open external URLs from the desktop app. A new permission entry opener:allow-open-url was added to src-tauri/capabilities/default.json. The Tauri opener plugin was added to manifests (package.json, src-tauri/Cargo.toml) and initialized in src-tauri/src/lib.rs. NavbarLink2.vue was refactored to use handleItemClick(listItem) which opens href values via Tauri's WebviewWindow with a window.open fallback and now removes the ui:close-menus listener on unmount. A simulator event listener key was renamed from learn-digital-circuit to learn-digital-logic.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: navbar Help menu links not opening in the desktop app, which is the primary objective of this PR.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #949: enables external Help menu links to open in the user's browser via Tauri's opener plugin, adds necessary permissions and dependencies, fixes the event listener name mismatch, and preserves non-link item behavior.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the Help menu navigation issue: adding opener plugin support, updating the click handler, fixing event names, and adding required permissions. No unrelated modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/Navbar/NavbarLinks/NavbarLink/NavbarLink2.vue`:
- Line 77: The label generation using Date.now() in NavbarLink2.vue (const label
= `help-${Date.now()}`) can collide on rapid clicks and may include
non-alphanumeric characters; replace it with a deterministic, module-level
incremental counter (e.g., declare a let helpLabelCounter = 0 at module scope)
and generate labels like `help-${++helpLabelCounter}` to guarantee uniqueness
and alphanumeric-only values; update any references that use this label so they
continue to receive the new counter-based value.
- Line 77: The current label creation uses Date.now() which can collide under
rapid clicks; replace it with a module-scoped monotonic counter (e.g., declare a
top-level let helpWindowCounter = 0) and build the WebviewWindow label using an
incremented counter (e.g., `help-${++helpWindowCounter}`) where the label is
currently created (the `label` const in the handler that constructs the
WebviewWindow), ensuring each new WebviewWindow gets a unique label across rapid
invocations.
- Around line 73-93: Replace the Tauri WebviewWindow usage with the opener
plugin and make the call resilient: instead of importing and constructing
WebviewWindow, import the opener binding (use the openUrl/open function from
`@tauri-apps/plugin-opener`) and await it; ensure the await is wrapped in
try-catch so any async failure falls back to window.open(url, '_blank') (do not
return before fallback). Update the code paths around WebviewWindow, the
try-catch block that currently surrounds the import/constructor, and ensure the
else branch still calls logixFunction[listItem.itemid]() unchanged.
- Around line 73-93: Replace the WebviewWindow flow in the click handler (the
block that imports '@tauri-apps/api/core' and uses WebviewWindow) with the Tauri
opener plugin: import and await openUrl(url) from '@tauri-apps/plugin-opener'
when isTauri() is true, call openUrl(url) and only fall back to window.open(url,
'_blank') on error; remove the synchronous WebviewWindow constructor and its
early return so async failures don't silently drop navigation, and ensure errors
are caught/logged; also add the JS dependency '@tauri-apps/plugin-opener' and
enable the corresponding Rust plugin capability (opener:allow-open-url or
opener:default) in the Tauri config so openUrl will work.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5adad52 and ef5326f.

📒 Files selected for processing (2)
  • src-tauri/capabilities/default.json
  • src/components/Navbar/NavbarLinks/NavbarLink/NavbarLink2.vue

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src-tauri/src/lib.rs (1)

160-176: ⚠️ Potential issue | 🔴 Critical

Fix event name mismatch: backend emits "learn-digital-logic" but frontend listens for "learn-digital-circuit".

The native Help menu items emit events that listeners.js handles. Verification found that three of four are correctly named (user-manual, discussion-forum, tutorial), but there is a critical mismatch: the backend emits "learn-digital-logic" (line 170, src-tauri/src/lib.rs) while the frontend listener is registered for "learn-digital-circuit" (src/simulator/src/listeners.js). This breaks the "Learn Digital Logic" native menu item.

Align the event names between backend and frontend, or update the listener in listeners.js to match the backend's emitted event name.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src-tauri/src/lib.rs` around lines 160 - 176, The backend emits the native
Help menu event as "learn-digital-logic" but the frontend listener in
listeners.js is registered for "learn-digital-circuit", causing the menu item to
not work; fix by making the names identical—either change the emitter in
src-tauri/src/lib.rs (the branch checking event.id() == "learn-digital-logic"
and calling app.emit(...)) to emit "learn-digital-circuit", or update the
frontend listener in listeners.js to listen for "learn-digital-logic" so the
event name used by app.emit and the listener match exactly.
🧹 Nitpick comments (1)
src-tauri/Cargo.toml (1)

28-28: Consider pinning to an explicit version for consistency.

The file uses explicit versions for some plugins (tauri-plugin-fs = "2.3.0") and loose major versions for others (tauri-plugin-http = "2"). While Cargo.lock ensures reproducibility regardless, aligning on a pinning strategy within the file improves clarity about the intended minimum version.

♻️ Proposed change
-tauri-plugin-opener = "2"
+tauri-plugin-opener = "2.0.0"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src-tauri/Cargo.toml` at line 28, The dependency declaration
tauri-plugin-opener = "2" is using a loose major-only constraint; update the
Cargo.toml entry for tauri-plugin-opener to an explicit pinned version (matching
your project's pinning style, e.g., the same form as tauri-plugin-fs = "2.3.0")
so the manifest clearly documents the intended minimum version; edit the
tauri-plugin-opener line to the chosen exact version string and run cargo update
or cargo generate-lockfile to refresh Cargo.lock if needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src-tauri/src/lib.rs`:
- Around line 160-176: The backend emits the native Help menu event as
"learn-digital-logic" but the frontend listener in listeners.js is registered
for "learn-digital-circuit", causing the menu item to not work; fix by making
the names identical—either change the emitter in src-tauri/src/lib.rs (the
branch checking event.id() == "learn-digital-logic" and calling app.emit(...))
to emit "learn-digital-circuit", or update the frontend listener in listeners.js
to listen for "learn-digital-logic" so the event name used by app.emit and the
listener match exactly.

---

Nitpick comments:
In `@src-tauri/Cargo.toml`:
- Line 28: The dependency declaration tauri-plugin-opener = "2" is using a loose
major-only constraint; update the Cargo.toml entry for tauri-plugin-opener to an
explicit pinned version (matching your project's pinning style, e.g., the same
form as tauri-plugin-fs = "2.3.0") so the manifest clearly documents the
intended minimum version; edit the tauri-plugin-opener line to the chosen exact
version string and run cargo update or cargo generate-lockfile to refresh
Cargo.lock if needed.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef5326f and a71381a.

⛔ Files ignored due to path filters (2)
  • package-lock.json is excluded by !**/package-lock.json
  • src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • package.json
  • src-tauri/Cargo.toml
  • src-tauri/capabilities/default.json
  • src-tauri/src/lib.rs
  • src/components/Navbar/NavbarLinks/NavbarLink/NavbarLink2.vue
✅ Files skipped from review due to trivial changes (1)
  • package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • src-tauri/capabilities/default.json
  • src/components/Navbar/NavbarLinks/NavbarLink/NavbarLink2.vue

@abhiraj75
Copy link
Contributor Author

@naman79820 I have updated my approach by using @tauri-apps/plugin-opener instead of WebviewWindow

@naman79820
Copy link
Contributor

I am not the one who review the code, Other than that Ci is failing right now and also resolve the CodeRabbit suggestions so that the maintainer can review it. @abhiraj75

@abhiraj75
Copy link
Contributor Author

abhiraj75 commented Feb 27, 2026

Two small fixes:
(1) the "Learn Digital Logic" Help menu item wasn't working in the desktop app because the Tauri backend emitted learn-digital-logic but the frontend listener in listeners.js was listening for learn-digital-circuit , updated the listener to match;
(2) pinned tauri-plugin-opener to 2.5.3 in Cargo.toml for consistency with other pinned deps like tauri-plugin-fs.

@abhiraj75
Copy link
Contributor Author

@Nihal4777 Let me know if you have any suggestions! Thanks!

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.

🐞 Bug: Navbar menu Help not redirecting to external pages in Desktop App

2 participants