Skip to content

fix: Do not open side navigation from close button - #4838

Merged
jperals merged 3 commits into
mainfrom
dev-v3-jotresse-nav-close-button
Jul 27, 2026
Merged

fix: Do not open side navigation from close button#4838
jperals merged 3 commits into
mainfrom
dev-v3-jotresse-nav-close-button

Conversation

@jperals

@jperals jperals commented Jul 27, 2026

Copy link
Copy Markdown
Member

Description

After #4688, clicking the side navigation close button works as a toggle button, i.e, it closes the side navigation when it is open, but it also opens it if it's closed. This is meant for the newly introduced "collapse" behavior. In the "hide" behavior the button cannot really be closed by real users because the close button has display: close when the side navigation is closed, but it is still accessible by the test utils, and this change in behavior broke a customer's tests (build: 7949323707)

How has this been tested?

  • Added unit tests
  • Dry run: 7950984806
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jperals
jperals requested a review from Copilot July 27, 2026 15:52
@jperals
jperals marked this pull request as ready for review July 27, 2026 15:53
@jperals
jperals requested a review from a team as a code owner July 27, 2026 15:53
@jperals
jperals requested review from SpyZzey and removed request for a team July 27, 2026 15:53
@jperals
jperals enabled auto-merge July 27, 2026 15:53

Copilot AI 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.

Pull request overview

Fixes a regression introduced after #4688 where the side navigation “close” button could act as a toggle and reopen navigation when it was already closed under the navigationCloseBehavior="hide" mode (notably affecting test-utils driven interactions).

Changes:

  • Adjusted the navigation close button click logic to avoid reopening the navigation when it is not meant to be collapsible.
  • Added a unit test asserting the close button does not reopen navigation when already closed (hide behavior).
  • Added a unit test asserting the close button toggles open/closed when navigationCloseBehavior="collapse" (collapsed-rail behavior).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/app-layout/visual-refresh-toolbar/navigation/index.tsx Updates close button click behavior to prevent unintended reopening when navigation isn’t collapsible.
src/app-layout/tests/navigation-collapsed.test.tsx Adds coverage for toggling behavior in collapsible (collapse) mode.
src/app-layout/tests/app-layout-navigation.test.tsx Adds regression test ensuring close button does not reopen navigation when already closed (hide mode).

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

Comment on lines 92 to 95
ariaExpanded={navigationCollapsible && !isMobile ? navigationOpen : undefined}
iconName={navigationCollapsed ? 'angle-right' : isMobile ? 'close' : 'angle-left'}
onClick={() => onNavigationToggle(!navigationOpen)}
onClick={() => onNavigationToggle(navigationCollapsible ? !navigationOpen : false)}
variant="icon"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

True, but this will not be called in a real environment when navigation is already closed

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.62%. Comparing base (a2bc00a) to head (b81f373).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4838   +/-   ##
=======================================
  Coverage   97.62%   97.62%           
=======================================
  Files         956      956           
  Lines       31012    31012           
  Branches    11409    11411    +2     
=======================================
  Hits        30277    30277           
+ Misses        728      688   -40     
- Partials        7       47   +40     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jperals
jperals added this pull request to the merge queue Jul 27, 2026
Merged via the queue into main with commit bc0a6c9 Jul 27, 2026
59 checks passed
@jperals
jperals deleted the dev-v3-jotresse-nav-close-button branch July 27, 2026 17:00
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.

3 participants