Skip to content

fix: focus and onClick issue on HeaderMenuItem #19495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2025
Merged

Conversation

2nikhiltom
Copy link
Contributor

@2nikhiltom 2nikhiltom commented May 28, 2025

Closes #19436
Closes #19401

Added back the TabIndex default value to 0 if not passed

Changelog

New

Added test cases and story for testing/reviewing

Changed

sets default value to 0 inside the function body
const resolvedTabIndex = tabIndex ?? 0;

Testing / Reviewing

ci should pass
verify that HeaderMenuItem is focusable via keyboard navigation and onClick is called (verify in console )

⚠️ BEFORE MERGE ⚠️

  • story to be removed before merging

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y)
  • Tested for cross-browser consistency
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide

@2nikhiltom 2nikhiltom requested review from a team as code owners May 28, 2025 13:30
Copy link

netlify bot commented May 28, 2025

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit d911ab0
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/683fe3bae905930008ad433f
😎 Deploy Preview https://deploy-preview-19495--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link

netlify bot commented May 28, 2025

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit d911ab0
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/683fe3bac174fa00083907e3
😎 Deploy Preview https://deploy-preview-19495--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.48%. Comparing base (a975063) to head (d911ab0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #19495   +/-   ##
=======================================
  Coverage   84.48%   84.48%           
=======================================
  Files         373      373           
  Lines       14735    14736    +1     
  Branches     4838     4891   +53     
=======================================
+ Hits        12449    12450    +1     
+ Misses       2139     2138    -1     
- Partials      147      148    +1     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

@adamalston adamalston left a comment

Choose a reason for hiding this comment

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

On #19436 (comment), do we know why the default was deleted?

@2nikhiltom
Copy link
Contributor Author

Hey @adamalston
Spoke with @Gururajj77 - the change appeared to be unintentional while resolving TypeScript issues during the React v19 dependency update. commit reference

@adamalston
Copy link
Contributor

Sounds good. Since that was just one change in #18207 — a pull request with over 2,500 lines of changes — should someone go through it to confirm there were no other unintentional changes? Maybe that’s unnecessary, but it doesn’t hurt to ask.

@tay1orjones
Copy link
Member

@adamalston I looked through it again and didn't see anything of note. It's possible the tabindex change was output from one of the codemods for react 19 or the related typescript updates.

@2nikhiltom 2nikhiltom requested a review from tay1orjones June 3, 2025 08:37
Copy link
Contributor

@riddhybansal riddhybansal left a comment

Choose a reason for hiding this comment

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

LGTM 💯

@riddhybansal riddhybansal added this pull request to the merge queue Jun 4, 2025
Merged via the queue into main with commit 6238278 Jun 4, 2025
37 checks passed
@riddhybansal riddhybansal deleted the 19436_menuItem branch June 4, 2025 07:09
@carbon-automation
Copy link
Contributor

Hey there! v11.84.0 was just released that references this issue/PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: onClick doesn't work on a HeaderMenuItem if there is no href prop [Bug]: onClick doesn't work on a HeaderMenu 's sub item, in safari browser.
5 participants