-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with keyboard navigation on KDropdownMenu #588
Comments
Can I get this assigned? |
Hi @galovdev, thank you for volunteering, I will assign you |
Hello @galovdev, are you still interested in contributing on this issue? If not, we will reassign it. |
Hi, please give me this weekend, Im working on the other issue |
Thank you @galovdev - no problem. Please reach out if you have any questions. |
Hi @galovdev, are you still planning to work on this? |
Hey @AlexVelezLl may I work on this issue? |
Hey @Sahil-Sinha-11! Yes, for sure! You are welcome! I will assign this issue to you! :) |
Hey @AlexVelezLl I am a bit lost in the code can you please guide me a bit.. 😅. I tried using handlekeyNavigation and event listeners on keydown but did not get any progress. |
Hey @Sahil-Sinha-11. For sure! For number 2, we can see how KModal handles the lastFocus element kolibri-design-system/lib/KModal.vue Line 254 in ea611a5
kolibri-design-system/lib/KModal.vue Line 287 in ea611a5
destroyed hook wouldnt work because I think it doesnt get destroyed but just hidden, so we will need to figure out a way of notifying when the dropdown is hidden and then return the focus when that happens.
Hope this helps :), let me know if you need more guidance. |
Screen.Recording.2024-11-08.at.12.16.34.AM.movHey @AlexVelezLl Thanks a lot for the help. Should this be the expected behavior for issue 1? I tried to make some changes in kmodel tracking dropdown and resetting focus but I was not able to produce the expected results. Can you please give me some more guidance. |
Hey @Sahil-Sinha-11, yes that is the expected behaviour 🎉.
Could you open a PR with your code, please?, so we can discuss better there 🤗 |
Sure @AlexVelezLl , I opened PR#818. 😃 |
Thanks @Sahil-Sinha-11! I will take a look |
Thanks @Sahil-Sinha-11 and @AlexVelezLl.
@Sahil-Sinha-11 Generally, it would be helpful to mention in your PR what approaches you tried or do some debugging and describe what you're observing exactly. We're happy to provide guidance and support, however that will be rather in the form of giving direction and answering concrete questions, rather than resolving the issue in question. |
Thank you for the suggestion! I realize I should have shared my approach as well, my apologies. Here’s how I’ve been tackling it so far...@MisRob @AlexVelezLl , |
Thanks @Sahil-Sinha-11, this is helpful. Overall looks like a good direction. Some first suggestions: (1) Where is the place where the previously focused element gets saved to kolibri-design-system/lib/KModal.vue Line 254 in ea611a5
(2) If (1) is satisfied, I'd recommend next steps would be to debug, e.g. console log the active element and |
Hey @Sahil-Sinha-11! I think there has been a misunderstanding here 😅. The change isnt needed in KModal, but in KDropdownMenu. We need to replicate in So when we open it, we need to store the element that is focused before any of the items in the menu gets the focus. And when we close the dropdown, we need to return the focus to the element that was focused before we open the dropdown. Hope this helps clarifying what is needed 🤗. |
Hey @MisRob, Its in the before mount |
@Sahil-Sinha-11 Wonderful, thanks. Yes, |
Closed by #818 |
Product
Noted in Studio, and in the KDS Docs on the last example of KListWithOverflow.
Expected behavior
Two things are not working very well right now:
options
list, We can include dividers with a{ type: "Divider" }
object.tab
oresc
, we should return the focus to the last element focused before KDropdownMenu was active. This can be done by saving thedocument.activeElement
before focusing the first option of the dropdown menu.Actual behavior
esc
ortab
is pressed, the focus returns to the first focusable element on the document after a second. But before the focus returns to the body, the next option in the menu is focused, and after a second, the menu closes, which is a bit misleading since, at first, it seems that we could navigate through the menu with a tab.Steps to reproduce the issue
Additional information
Compartir.pantalla.-.2024-03-25.16_22_53.mp4
The text was updated successfully, but these errors were encountered: