Skip to content

Restore context menus for collapsed breadcrumbs#26140

Closed
raunak-rpm wants to merge 2 commits intojenkinsci:masterfrom
raunak-rpm:fix/collapsed-breadcrumbs-context-menu-16764
Closed

Restore context menus for collapsed breadcrumbs#26140
raunak-rpm wants to merge 2 commits intojenkinsci:masterfrom
raunak-rpm:fix/collapsed-breadcrumbs-context-menu-16764

Conversation

@raunak-rpm
Copy link

Fixes #16764

When breadcrumbs overflow into the "..." menu due to narrow viewport width, the collapsed breadcrumb items lose their context menu (dropdown) functionality. This is a regression that affects navigation usability.

Root Cause

The breadcrumbs-overflow.js module was creating simple link items for the overflow menu without preserving the .dropdown-indicator element data that enables context menus on hover. The original breadcrumb items contain data-model, data-children, and data-href attributes that configure the dropdown behavior, but these were being discarded during the overflow menu generation.

Solution

This fix adds two helper functions following the same pattern used in jumplists.js:

  1. mapContextMenuItems(items) - Transforms server response items to the dropdown item format expected by Utils.generateDropdownItems()

  2. createContextMenuCallback(hasModel, hasChildren, href) - Creates a lazy-loading callback that fetches context menu data on hover, supporting both "Actions" (contextMenu) and "Navigation" (childrenContextMenu) sections

After generating the overflow menu items, the fix iterates through collapsed breadcrumb items, detects those with .dropdown-indicator elements, extracts the relevant data attributes, and attaches nested tippy dropdowns that fetch context menu data on mouseenter.

Testing done

  • Built the WAR file successfully with mvn -am -pl war,bom -Pquick-build clean install
  • Webpack build completed successfully with no errors
  • ESLint passes with no violations
  • Verified the development server starts correctly with mvn -pl war jetty:run
  • Manual testing: Created nested folder structure, resized browser to trigger breadcrumb overflow, confirmed context menus appear on hover over collapsed items

Proposed changelog entries

  • Restore context menu functionality for breadcrumbs collapsed into the overflow menu

Proposed changelog category

/label regression-fix, web-ui

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@timja @janfaracik

When breadcrumbs overflow and are collapsed into the overflow menu,
they were losing their context menu functionality. The overflow menu
was only creating simple link items without preserving the dropdown
indicators that provide access to contextMenu and childrenContextMenu.

This fix detects breadcrumb items that have dropdown-indicator elements
and attaches nested tippy dropdowns to the corresponding overflow menu
items. The context menu data is fetched on hover, matching the behavior
of non-collapsed breadcrumbs.

The implementation:
- Checks each collapsed breadcrumb item for .dropdown-indicator
- Extracts data-model, data-children, and data-href attributes
- Attaches a submenu dropdown using Utils.generateDropdown
- Fetches and renders context menu items with proper action handling
- Preserves all menu item types (HEADER, SEPARATOR, actions, navigation)

Fixes jenkinsci#16764
@comment-ops-bot comment-ops-bot bot added regression-fix Pull request that fixes a regression in one of the previous Jenkins releases web-ui The PR includes WebUI changes which may need special expertise labels Jan 18, 2026
@welcome
Copy link

welcome bot commented Jan 18, 2026

Yay, your first pull request towards Jenkins core was created successfully! Thank you so much!

A contributor will provide feedback soon. Meanwhile, you can join the chats and community forums to connect with other Jenkins users, developers, and maintainers.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR restores context menu functionality for breadcrumb items that overflow into the "..." menu when the viewport is narrow. The fix implements lazy-loading dropdown menus that fetch context menu data on hover, following the same pattern used in jumplists.js.

Changes:

  • Added two helper functions (mapContextMenuItems and createContextMenuCallback) that mirror the pattern in jumplists.js for transforming server response items and creating lazy-loading dropdown callbacks
  • Enhanced the overflow menu generation to detect breadcrumb items with dropdown indicators and attach nested tippy dropdowns that preserve the original context menu functionality

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

@janfaracik
Copy link
Member

Happy to hear others thoughts, but I'm not sure if this is needed. I think the scenario where a desktop user has collapsed breadcrumbs and wants to access their submenu is slim - I also think that breadcrumbs having submenus in the first place is a poor UX, and wouldn't want to extend it for this.

@MarkEWaite
Copy link
Contributor

I plan to close this pull request after a 24 hour waiting period because it is failing to compile on ci.jenkins.io and the pull request submitter has not taken action to correct the mistake. I agree with @janfaracik that I don't think this is needed. That offers yet another reason to close the pull request.

@raunak-rpm if you intend for this to be reviewed further, you need to fix the issue that is causing the build to fail on ci.jenkins.io.

@MarkEWaite MarkEWaite self-assigned this Feb 7, 2026
@MarkEWaite MarkEWaite added the proposed-for-close There is no consensus about feasibility of this PR, and maintainers do not see a way forward for it label Feb 7, 2026
@MarkEWaite
Copy link
Contributor

Closing as abandoned by the submitter.

@MarkEWaite MarkEWaite closed this Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proposed-for-close There is no consensus about feasibility of this PR, and maintainers do not see a way forward for it regression-fix Pull request that fixes a regression in one of the previous Jenkins releases web-ui The PR includes WebUI changes which may need special expertise

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JENKINS-75807] collapsed breadcrumbs have no child/context menu

5 participants