@oliw wrote:
I’m trying to build a list component that
- keeps track of which element is selected
- is keyboard navigable, i.e. if you tap the Up Arrow key, it selects the previous list item
So far I’ve got this
{{#ow-list items=owListItems as |item isSelected selectPrevious selectNext selectItem|}} {{ow-entry selected=isSelected onUp=selectPrevious onDown=selectNext onClick=selectItem}} {{/ow-list}}
This is my first iteration but I think its flawed because it relies on elements within the list to listen for the Up keyboard event and pass it up the list component, even though keyboard events aren’t a concern of the the element within the list.
Can anyone help me articulate the antipatterns that exist in the snippet above?
Thanks!
Posts: 1
Participants: 1