MeadowlarkDAW / project-board

Project board for the Meadowlark DAW project
0 stars 0 forks source link

Add keyboard functionality to drop-down menus #136

Open BillyDM opened 1 month ago

BillyDM commented 1 month ago

The DropDownMenu element should have the functionality to be navigated using the up-and-down arrow keys, selecting an option with the enter key, and hiding itself if the escape key.

XavilPergis commented 1 week ago

So I was giving this a try and have a few notes/questions.

  1. Should pressing down when the end of the list is selected wrap around to the beginning?
  2. Right now, selecting an element and exiting the menu will make the menu lose focus, but should this be the case? Or should it just close the menu while retaining focus so you can re-open the menu with another keystroke hypothetically?
  3. I've implemented closing the menu by releasing focus on the menu element, like clicking off with the mouse already does. Maybe as a consequence, I have to either move my mouse outside of the menu's bounds and then back in or click on the element again before I can interact with the dropdown menu. Is there a better way for me to implement this, or should this be handled elsewhere in the codebase?
BillyDM commented 1 week ago
  1. This could be a flag in the element handle to let the user decide what behavior they want. I would say enable wrapping by default.
  2. Yeah, I've been thinking about this, and I think I need to improve keyboard navigation functionality in Yarrow. Mouse focus and keyboard focus should probably be two separate things. I'll work on this while I'm rewriting Yarrow's API.