bpmn-io / diagram-js

A toolbox for displaying and modifying diagrams on the web.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arrow keys don't work in popup menu

smbea opened this issue · comments

Describe the Bug

Arrow keys don't work in popup menu when search is turned off

Steps to Reproduce

Steps to reproduce the behavior:

Screen.Recording.2022-11-21.at.09.56.30.mov
  1. open popup menu for sub process
  2. use arrow up/down
  3. see that element moves instead of navigating the menu

Expected Behavior

The arrow keys should result in menu navigation

Environment

Please complete the following information:

  • Library version: 11.0.0

Cause: This happens because the keyDown listeners were added to the search input when it is focused. Causing this to be lost when the search is not rendered

Possible solution: Attach listeners to menu itself and not search input

Further root causing:

  • adding tab-index=-1 to the popup menu allows us to focus it programmatically
  • HOWEVER: Keyboard will always use the capture phase to intercept events; as a result we cannot hook in before it 🙈

Some work-in-progress fix for this is part of #706

We want to solve #707 before this, since it affects how this bug is solved.