Skip to content

fix scroll sub menu when current page is not in the current sub-menu … - #2706

Open
benjgil wants to merge 3 commits into
mainfrom
fix(core-ix-application-menu)-scroll-sub-menu-fix
Open

fix scroll sub menu when current page is not in the current sub-menu …#2706
benjgil wants to merge 3 commits into
mainfrom
fix(core-ix-application-menu)-scroll-sub-menu-fix

Conversation

@benjgil

@benjgil benjgil commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

💡 What is the current behavior?

If an application sub-menu contains enough items to create a scroll, the scroll is only visible when the user is on a page that is in that sub-menu. If the user is on a page that is NOT inside the long sub-menu, and then hovers on the main nav menu item that contains the sub-menu, then the sub-menu scroll is not visible and items in the sub-menu are not clickable

GitHub Issue Number: #2664

🆕 What is the new behavior?

Fix the bug by setting showDropdown to true before the dropdown children and scroll are calculated

🏁 Checklist

A pull request can only be merged if all of these conditions are met (where applicable):

  • 🦮 Accessibility (a11y) features were implemented
  • 🗺️ Internationalization (i18n) - no hard coded strings
  • 📲 Responsiveness - components handle viewport changes and content overflow gracefully
  • 📕 Add or update a Storybook story
  • 📄 Documentation was reviewed/updated siemens/ix-docs
  • 🧪 Unit tests were added/updated and pass (pnpm test)
  • 📸 Visual regression tests were added/updated and pass (Guide)
  • 🧐 Static code analysis passes (pnpm lint)
  • 🏗️ Successful compilation (pnpm build, changes pushed)

👨‍💻 Help & support

Summary by CodeRabbit

  • Bug Fixes

    • Fixed menu category dropdowns so they open reliably and display all items correctly.
    • Long dropdown menus are now scrollable, keeping the final item visible.
  • Tests

    • Added regression coverage for dropdowns containing many inactive items.

@benjgil benjgil added this to the 5.2.0 milestone Aug 9, 2026
@netlify

netlify Bot commented Aug 9, 2026

Copy link
Copy Markdown

Deploy Preview for ix-storybook ready!

Name Link
🔨 Latest commit 0195139
🔍 Latest deploy log https://app.netlify.com/projects/ix-storybook/deploys/6a788d79a54f0d000836fba7
😎 Deploy Preview https://deploy-preview-2706--ix-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@changeset-bot

changeset-bot Bot commented Aug 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0195139

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@siemens/ix Patch
@siemens/ix-angular Patch
@siemens/ix-docs Patch
@siemens/ix-react Patch
@siemens/ix-vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ef7b817b-51b9-49d0-b75b-b6bbc5a4f09c

📥 Commits

Reviewing files that changed from the base of the PR and between c8038a7 and 0195139.

📒 Files selected for processing (1)
  • .changeset/menu-category-dropdown-scroll.md

📝 Walkthrough

Walkthrough

The menu category enables its dropdown before presenting it. A regression test verifies scrolling and last-item visibility for a dropdown with 19 inactive items. A patch changeset documents the fix.

Changes

Menu category dropdown

Layer / File(s) Summary
Dropdown state and regression coverage
packages/core/src/components/menu-category/menu-category.tsx, packages/core/src/components/menu-category/test/menu-category.ct.ts, .changeset/menu-category-dropdown-scroll.md
showMenuItemDropdown enables the dropdown before presentation. The regression test checks overflow and visibility of the final item. The changeset records the patch release.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • siemens/ix#2573: Both changes modify menu category dropdown visibility behavior and regression coverage.
  • siemens/ix#2666: Both changes modify menu-category dropdown interaction tests and scroll-related behavior.
🚥 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 clearly describes the sub-menu scrolling fix when the current page is outside the active sub-menu.
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
  • Commit unit tests in branch fix(core-ix-application-menu)-scroll-sub-menu-fix

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: 1

🤖 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 `@packages/core/src/components/menu-category/test/menu-category.ct.ts`:
- Around line 587-595: Update the scrollability test around menuCategory to
exercise the interaction path: scroll the final non-parent menu item into the
dropdown’s visible area, click it, and assert that the dropdown closes. Retain
the overflow assertion, but replace the visibility-only check with assertions
that validate the user-facing selection behavior.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 02b26243-59e8-4ba9-beb3-a83b677fb8a0

📥 Commits

Reviewing files that changed from the base of the PR and between 5c43ed5 and c8038a7.

📒 Files selected for processing (2)
  • packages/core/src/components/menu-category/menu-category.tsx
  • packages/core/src/components/menu-category/test/menu-category.ct.ts

Comment on lines +587 to +595
const isScrollable = await dropdown.evaluate((el) => {
return el.scrollHeight > el.clientHeight;
});
expect(isScrollable).toBe(true);

const lastItem = menuCategory
.locator('ix-menu-item:not(.category-parent)')
.last();
await expect(lastItem).not.toBeHidden();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Exercise the scroll and click path.

scrollHeight > clientHeight only proves that overflow exists. not.toBeHidden() also passes when the final item is outside the visible scrollport. Scroll the final item into view, click it, and assert the dropdown closes. This validates the user interaction fixed by this PR.

Proposed test update
     expect(isScrollable).toBe(true);

     const lastItem = menuCategory
       .locator('ix-menu-item:not(.category-parent)')
       .last();
-    await expect(lastItem).not.toBeHidden();
+    await lastItem.scrollIntoViewIfNeeded();
+    await expect(lastItem).toBeInViewport();
+    await lastItem.click();
+    await expect(dropdown).not.toBeVisible();

As per coding guidelines, update tests for user-facing behavior changes and use core component tests for interaction behavior.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const isScrollable = await dropdown.evaluate((el) => {
return el.scrollHeight > el.clientHeight;
});
expect(isScrollable).toBe(true);
const lastItem = menuCategory
.locator('ix-menu-item:not(.category-parent)')
.last();
await expect(lastItem).not.toBeHidden();
const isScrollable = await dropdown.evaluate((el) => {
return el.scrollHeight > el.clientHeight;
});
expect(isScrollable).toBe(true);
const lastItem = menuCategory
.locator('ix-menu-item:not(.category-parent)')
.last();
await lastItem.scrollIntoViewIfNeeded();
await expect(lastItem).toBeInViewport();
await lastItem.click();
await expect(dropdown).not.toBeVisible();
🤖 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 `@packages/core/src/components/menu-category/test/menu-category.ct.ts` around
lines 587 - 595, Update the scrollability test around menuCategory to exercise
the interaction path: scroll the final non-parent menu item into the dropdown’s
visible area, click it, and assert that the dropdown closes. Retain the overflow
assertion, but replace the visibility-only check with assertions that validate
the user-facing selection behavior.

Source: Coding guidelines

@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

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