JLambertazzo / ListExtender

A JavaScript library providing interactive lists
MIT License
17 stars 29 forks source link

Go to next input element on enter #11

Closed JLambertazzo closed 3 years ago

JLambertazzo commented 3 years ago

Right now on enter the list will be unfocused, we want to instead focus the next input element in the list.

MansiAyer commented 3 years ago

Hi, I'd like to attempt to solve this, but I'm not sure if I understand it correctly. I tried the demo on https://www.julienbl.me/ListExtender/ so does this issue mean the part where after adding a new element the focus is not on the input box? If I've got it wrong, could you please explain this issue to me a bit more?

JLambertazzo commented 3 years ago

Hey, if you're interested in this I'd be happy to assign you! When you're typing in an input box and you click tab on your keyboard, you'll see that the focus shifts from the current input to the next in the list. We're just looking to have that same behaviour when enter is pressed instead of tab.

MansiAyer commented 3 years ago

Okay, got it. I'm not very good at this but I'll fork the project and give it my best shot, if I am able to work it out then I'll get back to you. Thanks for the opportunity!

JLambertazzo commented 3 years ago

Sounds great, this issue is all yours. Good luck! 🚀

MansiAyer commented 3 years ago

So I've done a few changes and it seems to be working, I used console logs for list count and newly appended items to check if the code is okay. Could you please take a look and guide me if I've made any mistakes? This is a live preview of what I've implemented https://listextender.mansimansi.repl.co/

MansiAyer commented 3 years ago

Nevermind, I just realized I made a mistake. I'll fix it and get back to you

MansiAyer commented 3 years ago

I think I have fixed all possible issues this time, could you please take a look and lmk if I've missed anything? Live is again at https://listextender.mansimansi.repl.co/

Also when I was comparing the current live example at https://www.julienbl.me/ListExtender/ with my copy, I noticed an issue with the "key" values being assigned to list items. This doesn't affect how the ordered list looks on the page, it's just in the keys. Idk whether this affects functionality in any way, but these are the details:

Steps to recreate: When I start typing in the input box, a second input is added to the list. If I then clear what I was typing and then click outside the input box or hit enter, the old input box is deleted, but an input box is added to the list count. This skews the key value in the list items.

Screenshots: Initial html and console image image

After typing, then deleting typed text, and focusout/enter image image

JLambertazzo commented 3 years ago

This looks great, thank you so much! Whenever you're ready just create a pull request from your forked project and I'll merge it to master. I'll also add this key ordering as an issue, thank you for bringing it up! 😄

MansiAyer commented 3 years ago

Okay, thank you! 😃

JLambertazzo commented 3 years ago

Issue closed thanks to contribution from @MansiAyer 🎉