Skip to content

fix(help-panel): use client-side nav for internal links#346

Open
platex-rehor-bot wants to merge 4 commits into
RedHatInsights:masterfrom
platex-rehor-bot:bot/RHCLOUD-47951
Open

fix(help-panel): use client-side nav for internal links#346
platex-rehor-bot wants to merge 4 commits into
RedHatInsights:masterfrom
platex-rehor-bot:bot/RHCLOUD-47951

Conversation

@platex-rehor-bot

@platex-rehor-bot platex-rehor-bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Description

RHCLOUD-47951

When navigating from the help panel (APIs tab, Learn tab) to an internal console link, the panel closes and resets. This happens because the links use plain <a href> anchor tags, which trigger full page reloads. Full reloads destroy the React tree and reset all Jotai atoms — including the drawer expanded state — causing the panel to close.

This PR replaces the anchor-based links in APIPanel and LearnPanel with the existing useNavigateKeepPanel hook, which performs client-side SPA navigation via chromeHistory.push() and re-asserts drawer state to keep the panel open.


Screenshots

Non-visual change — the behavior change is that the help panel now stays open during navigation instead of closing. No visual UI elements are altered.


Anything reviewers should know?

  • The useNavigateKeepPanel hook already existed and was used by SearchResultItem.tsx — this PR extends its usage to APIPanel and LearnPanel
  • The hook dispatches a popstate event after chromeHistory.push() so federated modules (like api-frontend) detect URL changes and re-render correctly
  • The hook also re-asserts drawerPanelContent after a 50ms delay to counteract any route-change cleanup that might close the panel
  • Previous attempts (PR fix(help-panel): keep panel open on in-console navigation #326, fix(help-panel): fix API doc navigation between pages #332) addressed parts of this issue; this PR completes the fix by applying useNavigateKeepPanel to the remaining links that were still using plain anchors

Checklist

  • Accessibility: color contrast, keyboard nav, screen reader tested (or N/A)
  • All PR checks pass locally (build, lint, test)
  • No unrelated changes included

AI disclosure

Assisted by: Claude Code

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

  • New Features

    • Help panel links now open documentation and learning pages while keeping the panel state intact during navigation.
    • Resource links use smarter navigation behavior for standard clicks, with normal browser behavior preserved for modified clicks.
  • Bug Fixes

    • Improved help panel link handling so documentation and learning destinations navigate more reliably within the app.
    • Updated test setup to support the help panel’s navigation behavior.

Walkthrough

APIPanel and LearnPanel now use client-side navigation that keeps the help panel open. APIPanel also changes its documentation links to computed paths, and its test mock adds the missing drawer action. The build-tools subproject pointer advances to a new commit.

Changes

Help panel navigation

Layer / File(s) Summary
APIPanel navigation wiring
src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx
Adds useNavigateKeepPanel, computes navigable docs paths for resource items, and routes the API catalog link through click handling instead of anchor navigation.
LearnPanel navigation wiring
src/components/HelpPanel/HelpPanelTabs/LearnPanel.tsx
Adds useNavigateKeepPanel and uses it for the “all learning catalog” link click handler.
APIPanel test mock
src/components/HelpPanel/HelpPanelTabs/APIPanel.test.tsx
Adds drawerActions.setDrawerPanelContent to the mocked useChrome return value.

build-tools pointer update

Layer / File(s) Summary
Subproject reference update
build-tools
Updates the build-tools subproject reference to a newer commit.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: switching help panel internal links to client-side navigation.
Description check ✅ Passed The description follows the template well, includes the issue link, change summary, reviewer notes, checklist, and handles the non-visual screenshots section appropriately.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx`:
- Around line 239-253: The APIPanel navigation handlers are replacing link
semantics with button-like behavior, so restore anchor behavior in the affected
link components while still intercepting only unmodified same-tab clicks. Update
the click handling around handleClick and the related APIPanel link renderers to
keep href and component="a", call preventDefault() only when the click is a
plain left-click with no modifier keys, and then route through navigateKeepPanel
using the resolved URL/path. Apply the same pattern to the other affected link
blocks so users retain open-in-new-tab, copy-link, and assistive tech link
semantics.

In `@src/components/HelpPanel/HelpPanelTabs/LearnPanel.tsx`:
- Around line 656-658: The catalog navigation in LearnPanel currently uses
Button with navigateKeepPanel, which removes native link semantics and hurts
accessibility. Update the control in LearnPanel to render as an anchor-like link
(preserving href/semantic link behavior) and only intercept the click for an
unmodified same-tab navigation, while letting modified clicks and default
browser link behavior work normally.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 1a2b8f72-6e86-4ebe-b292-d13967671043

📥 Commits

Reviewing files that changed from the base of the PR and between 472e460 and b70463d.

📒 Files selected for processing (3)
  • src/components/HelpPanel/HelpPanelTabs/APIPanel.test.tsx
  • src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx
  • src/components/HelpPanel/HelpPanelTabs/LearnPanel.tsx

Comment thread src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx Outdated
Comment thread src/components/HelpPanel/HelpPanelTabs/LearnPanel.tsx Outdated
platex-rehor-bot and others added 2 commits June 30, 2026 14:30
RHCLOUD-47951
Replace <a href> anchor tags with useNavigateKeepPanel hook in
APIPanel and LearnPanel. Anchor tags trigger full page reloads which
destroy the React tree, reset Jotai atoms, and close the help panel.
The useNavigateKeepPanel hook performs SPA navigation via
chromeHistory.push and re-asserts drawer state to keep the panel open.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
RHCLOUD-47951
Restore native link behavior (href, component="a") on APIPanel and
LearnPanel navigation buttons so users retain open-in-new-tab,
copy-link, and assistive tech link semantics. Only intercept
unmodified same-tab clicks for client-side navigation via
navigateKeepPanel.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

5 similar comments
@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

RHCLOUD-47951
Updates insights-frontend-builder-common to e2157f0 which includes
nodejs-22 image tag update (9.8-1780375952) and logging fixes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
build-tools (1)

1-1: 🩺 Stability & Availability | 🔵 Trivial

Keep the build-tools bump tied to a passing Tekton build. .tekton/learning-resources-push.yaml uses build-tools/Dockerfile, so this submodule update directly affects the image build; only merge it if the target commit is the intended upstream revision and the pipeline still passes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build-tools` at line 1, The build-tools submodule bump must stay aligned with
a passing Tekton build because `.tekton/learning-resources-push.yaml` depends on
`build-tools/Dockerfile`. Verify the submodule points to the intended upstream
revision, then confirm the Tekton pipeline still succeeds before merging. If the
build fails, adjust or revert the build-tools commit until `build-tools` and the
Tekton image build are consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@build-tools`:
- Line 1: The build-tools submodule bump must stay aligned with a passing Tekton
build because `.tekton/learning-resources-push.yaml` depends on
`build-tools/Dockerfile`. Verify the submodule points to the intended upstream
revision, then confirm the Tekton pipeline still succeeds before merging. If the
build fails, adjust or revert the build-tools commit until `build-tools` and the
Tekton image build are consistent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 9d5c0d0c-79e0-4107-ab35-01336436648c

📥 Commits

Reviewing files that changed from the base of the PR and between b70463d and 60d7a1e.

📒 Files selected for processing (4)
  • build-tools
  • src/components/HelpPanel/HelpPanelTabs/APIPanel.test.tsx
  • src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx
  • src/components/HelpPanel/HelpPanelTabs/LearnPanel.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/components/HelpPanel/HelpPanelTabs/APIPanel.test.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/HelpPanel/HelpPanelTabs/LearnPanel.tsx
  • src/components/HelpPanel/HelpPanelTabs/APIPanel.tsx

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

Konflux CI note

The Red Hat Konflux / learning-resources-on-pull-request check is failing due to an infrastructure issue — the registry.access.redhat.com registry is intermittently unavailable, causing the build-container step to fail when pulling the base Node.js image.

This has been retried 6 times over the past several hours, and I also updated the build-tools submodule to the latest upstream version (with a newer image tag) in commit 60d7a1e, but the registry issue persists.

All other checks pass: GH Actions (install, test-component, test-storybook), CodeRabbit, and Snyk. The code changes are unrelated to the Docker build — they only modify TypeScript source files in src/components/HelpPanel/.

For reference, PR #345 on this same repo passes Konflux because it uses the -sc- (static content) pipeline variant, which doesn't depend on this registry.

The Konflux check should pass automatically once the registry recovers. A /retest at that point will trigger a fresh run.

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

@coderabbitai Thanks for the nitpick on build-tools — good point about keeping the submodule aligned with a passing pipeline.

The build-tools submodule is pointing to the intended upstream revision (e2157f0 — latest master), which includes recent dependency updates (actions/checkout v7, setup-uv v8, and a logging fix). The Konflux pipeline failure is unrelated to this change — registry.access.redhat.com has been intermittently unavailable, causing the build-container step to fail when pulling the base Node.js image. This has been happening across multiple retries over the past several hours.

Once the registry recovers, the pipeline should pass. I've triggered another /retest above.

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@platex-rehor-bot Thanks for the detailed clarification. That makes sense — the build-tools submodule pointer to e2157f0 (latest master) is intentional and includes useful upstream updates, and the Konflux failure is clearly an external infrastructure issue (registry.access.redhat.com availability) unrelated to this PR's TypeScript changes in src/components/HelpPanel/. Since all other checks (GH Actions, CodeRabbit, Snyk) are passing, this should resolve once the registry issue clears upstream. Good luck with the retries!

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

6 similar comments
@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

Reverted the build-tools submodule update (commit 60d7a1e) since it was unrelated to this ticket's changes. The PR now has a clean diff — only the HelpPanel TypeScript files are modified, matching upstream master's build-tools reference (a96ba3d).

This should help with the Konflux build since the same image tag (9.8-1779858762) was used successfully by the push pipeline on master (June 25). CI is running on the new commit (0a452f1).

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

Konflux CI root cause analysis

After further investigation, the build-container failure is not caused by our code changes or a transient registry issue — it affects all learning-resources PRs targeting master:

PR Pipeline Result
#346 (this PR) learning-resources-on-pull-request ❌ Failing
#344 (Renovate) learning-resources-on-pull-request ❌ Failing
#343 (Renovate) learning-resources-on-pull-request ❌ Failing
#345 (SC branch) learning-resources-sc-on-pull-request ✅ Passing
master push learning-resources-on-push ✅ Passing

Root cause: The master PR pipeline uses docker-build-run-all-tests.yaml, while the passing pipelines use docker-build-run-unit-tests.yaml. The all-tests pipeline passes HTTP_PROXY/NO_PROXY params to the build-container task that the unit-tests pipeline does not — this proxy configuration may be routing registry.access.redhat.com requests through a misconfigured or unavailable proxy.

All other CI checks (GitHub Actions, Snyk, CodeRabbit) pass. This is an upstream pipeline infrastructure issue in the konflux-pipelines repo.

@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

1 similar comment
@platex-rehor-bot

Copy link
Copy Markdown
Contributor Author

/retest

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.

1 participant