Skip to content

[CL-1430] Update keyboard handling for filter menu tree - #24840

Draft
vleague2 wants to merge 1 commit into
uif/cl-1430/tree-extractionfrom
uif/cl-1430/keyboard-handling
Draft

vleague2 wants to merge 1 commit into
uif/cl-1430/tree-extractionfrom
uif/cl-1430/keyboard-handling

Conversation

@vleague2

@vleague2 vleague2 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🎟️ Tracking

CL-1430

📔 Objective

This PR replaces CDK's TreeKeyManager in the multi-select bit-filter-menu tree with a custom keyboard handler that uses each row's position in the option list rather than its index. This prepares the tree for virtualization, where most rows won't be rendered.

I explored keeping the CDK TreeKeyManager, but it would require a decent amount of code to work around some limitations and bugs. It was less code and easier to follow the custom keyboard handling than to integrate with the CDK and add these workarounds:

  • Item objects must be reused, not rebuilt. The manager checks for its active item by object identity. If the item list is rebuilt from scratch, it forgets the user’s place and resets to the first row. That would have happened on every expand or collapse. We would have needed to add reuse logic.
  • Items that do not have children are still being tracked as "expanded" or "not expanded" by the CDK, which caused a bug with the right/left keyboard navigation (where those keys were flipping the "expanded" property internally but there is no actual change for the user, so it appears as if those key presses do nothing). This would need workaround code.
  • If the current active item has scrolled out of view and unmounted (which will happen when we support virtualization), and the user has navigated out of the tree and is tabbing back into it, focus should return to the currently active item. However, the CDK ignores a focus request for an already active item and would not perform the focus needed to scroll the item back into view and focus it again. This would need workaround code.

Keyboard behaviour is unchanged, with two bug fixes to existing behavior:

  • * (open all siblings) no longer moves focus to a different option when rows open above the focused one.
  • Left Arrow on an option with no children always moves to its parent. Before, pressing Right Arrow on the no-child option seemingly did nothing, and then pressing Left Arrow after that also seemingly did nothing.

@vleague2
vleague2 added this pull request to stack #24841 November 18, 2026 18:00
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.37500% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.24%. Comparing base (96002ff) to head (258eac6).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...omponents/src/filter-menu/filter-tree.component.ts 83.33% 4 Missing and 6 partials ⚠️
Additional details and impacted files
@@                       Coverage Diff                       @@
##           uif/cl-1430/tree-extraction   #24840      +/-   ##
===============================================================
+ Coverage                        63.22%   63.24%   +0.01%     
===============================================================
  Files                             5000     5000              
  Lines                           162594   162616      +22     
  Branches                         26225    26234       +9     
===============================================================
+ Hits                            102807   102851      +44     
+ Misses                           52805    52778      -27     
- Partials                          6982     6987       +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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