DavidVollmers / Ignis

The Blazor framework for building modern web applications.
https://ignis.dvolper.dev
MIT License
137 stars 8 forks source link

ListBox (Select) doesn't scroll when using keyboard arrows #52

Closed panoukos41 closed 2 months ago

panoukos41 commented 3 months ago

Hey, as I was trying the ListBox with a lot of items I noticed that the keyboard doesn't scroll the list. The items get's selected etc but you can't actually see it.

Actual behavior msedge_6

Expected behavior (from official library) msedge_4

panoukos41 commented 2 months ago

Hey @DavidVollmers are you working on this or could I give it a try? I implemented a search just like html select element using the onkeydown on a ListBox. It scrolls the itme found in place so I would love to give it a try and then maybe try to PR my implementation for the search using keydown as a feature 😃

DavidVollmers commented 2 months ago

Hey there!

Feel free to give it a try, although the scroll implementation will be a little bit tricky here.

The keydown logic is implemented here: https://github.com/DavidVollmers/Ignis/blob/8605ab346f475708461dcf33a2c2ceb9722d3d6c/packages/Tailwind/Ignis.Components.HeadlessUI/Aria/AriaPopupExtensions.cs#L21

But I think the best way to solve this issue is to overwrite the OnAfterOpen logic in all popups to scroll to its active descendant. For the listbox this could happen here: https://github.com/DavidVollmers/Ignis/blob/8605ab346f475708461dcf33a2c2ceb9722d3d6c/packages/Tailwind/Ignis.Components.HeadlessUI/Listbox.cs#L270

DavidVollmers commented 2 months ago

We should fix this for all popups though. This means we should implement it in a way we can reuse the logic for the Listbox, Popover and Menu component.

panoukos41 commented 2 months ago

I see, I will give it a try with that in mind!

DavidVollmers commented 2 months ago

This is fixed with release 1.4.0