Skip to content

Conversation

Skaiir
Copy link
Contributor

@Skaiir Skaiir commented Sep 19, 2025

Related to bpmn-io/bpmn-js-create-append-anything#53

Proposed Changes

Ensure we use the post-grouping order when navigating the popup menu by keyboard.

Screencast.from.2025-09-19.10-48-42.webm

Ignore the disabled entries it's from another PR.

To try it out:

npx @bpmn-io/sr bpmn-io/bpmn-js-element-templates -l bpmn-io/diagram-js#cr-app-an-53-match-keyboard-nav-to-visual-order

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

@bpmn-io-tasks bpmn-io-tasks bot added the needs review Review pending label Sep 19, 2025
Copy link

This pull request targets the main branch. Please target main for bug fixes only. Target develop for regular feature development.

@Skaiir Skaiir requested a review from barmac September 19, 2025 09:25
@nikku
Copy link
Member

nikku commented Sep 19, 2025

@Skaiir Please verify this also works with search / filtering.

@Skaiir
Copy link
Contributor Author

Skaiir commented Sep 19, 2025

@nikku It does :)

@nikku
Copy link
Member

nikku commented Sep 19, 2025

UX wise this works like a charm:

capture RWdEOg_optimized

Can be tried out via

npx @bpmn-io/sr bpmn-io/bpmn-js-element-templates -l bpmn-io/diagram-js#cr-app-an-53-match-keyboard-nav-to-visual-order

@nikku
Copy link
Member

nikku commented Sep 19, 2025

@Skaiir Please target develop for new features.

@Skaiir
Copy link
Contributor Author

Skaiir commented Sep 19, 2025

@nikku This is a bug fix, no? :)

Copy link
Member

@nikku nikku left a comment

Choose a reason for hiding this comment

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

Thanks again for the contribution.

What I see (what we have to do) is to move the grouping concern to the menu, because we need it on the menu anyway. There is little merrit in having it inside the PopupMenuList.

6da8468 does the move so we don't do "double the work".

@nikku nikku force-pushed the cr-app-an-53-match-keyboard-nav-to-visual-order branch from 6da8468 to 140ab2d Compare September 19, 2025 18:13
@nikku nikku requested a review from Copilot September 19, 2025 18:13
Copy link

@Copilot 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 fixes keyboard navigation in popup menus to ensure entries are navigated in the visual order displayed to the user rather than the original array order. The issue occurred when entries had groups, as the grouping and sorting changed the visual order but keyboard navigation still used the original entry array order.

  • Modified keyboard navigation to use the post-grouping order for consistent user experience
  • Moved entry grouping logic from PopupMenuList to PopupMenuComponent for better data flow
  • Added comprehensive test coverage for grouped entry navigation scenarios

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/features/popup-menu/PopupMenuComponent.js Moved grouping logic here, updated keyboard navigation to use grouped entries order, exported groupEntries function
lib/features/popup-menu/PopupMenuList.js Removed grouping logic, now receives pre-grouped entries as props
lib/features/popup-menu/PopupMenuProvider.ts Added PopupMenuGroup type definition
test/spec/features/popup-menu/PopupMenuComponentSpec.js Added test for grouped entry navigation and reduced trigger timeout
test/spec/features/popup-menu/PopupMenuListSpec.js Updated test to use groupedEntries prop instead of entries

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 105 to +109
setEntries(newEntries);
}, [ selectedEntry, setEntries, setSelectedEntry ]);
}, [ setEntries, setSelectedEntry ]);
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

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

The dependency array for updateEntries callback is missing the selectedEntry dependency that was removed. While this might be intentional to avoid unnecessary re-renders, the callback still uses selectedEntry indirectly through the keyboard navigation logic. Consider if this could cause stale closure issues.

Copilot uses AI. Check for mistakes.

@nikku nikku force-pushed the cr-app-an-53-match-keyboard-nav-to-visual-order branch from 140ab2d to 9141939 Compare September 19, 2025 18:25
@nikku nikku requested a review from Copilot September 19, 2025 18:25
Copy link

@Copilot 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

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nikku
Copy link
Member

nikku commented Sep 19, 2025

@Skaiir The reduced timeout seems to be entirely unnecessary, cf. 9141939.

Impressive speedups, indeed:

Before

Chrome Headless 131.0.0.0 (Linux x86_64): Executed 1964 of 1969 (skipped 5) SUCCESS (50.053 secs / 36.621 secs)

This PR

Chrome Headless 131.0.0.0 (Linux x86_64): Executed 1965 of 1970 (skipped 5) SUCCESS (21.637 secs / 8.514 secs)

@nikku nikku merged commit 32a3dbc into main Sep 19, 2025
11 checks passed
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Sep 19, 2025
@nikku nikku deleted the cr-app-an-53-match-keyboard-nav-to-visual-order branch September 19, 2025 19:13
@nikku
Copy link
Member

nikku commented Sep 19, 2025

Released as v15.3.1.

nikku added a commit to bpmn-io/bpmn-js that referenced this pull request Sep 19, 2025
fix: ensure popup menu keyboard navigation accounts for entry grouping

  Related to bpmn-io/diagram-js#989
nikku added a commit to bpmn-io/bpmn-js that referenced this pull request Sep 19, 2025
fix: ensure popup menu keyboard navigation accounts for entry grouping

  Related to bpmn-io/diagram-js#989
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.

2 participants