Skip to content

fix(side-navigation): prevent disabled items from firing onClick - #5435

Open
Rauneet-coder wants to merge 1 commit into
uber:mainfrom
Rauneet-coder:fix/side-navigation-disabled-click
Open

Rauneet-coder wants to merge 1 commit into
uber:mainfrom
Rauneet-coder:fix/side-navigation-disabled-click

Conversation

@Rauneet-coder

Copy link
Copy Markdown

Description

Clicking <SideNavigationItem disabled onClick={handler}>Reports</SideNavigationItem> still invokes handler. The shared Item renders a disabled item as a div, but attaches onClick unconditionally.

Omit the callback when disabled. Add a small parameterized test in the existing navigation suite covering disabled and enabled clicks.

Validation

  • Reproduced before the fix: disabled items invoke the callback with and without href.
  • Verified after the fix using React 18/jsdom: disabled callbacks are suppressed and enabled callbacks still run. Six isolated checks also pass, including disabled-state changes and section toggling; the local harness substitutes the styling layer and UID hook.
  • Prettier and git diff --check pass.
  • The committed Testing Library test and full build/type checks could not be completed: npm registry DNS is unavailable and repository dependencies are missing. Direct TypeScript diagnostics are identical before and after the change.

Scope

Patch: Bug Fix

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