-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add tabIndex attribute to scroll to top btn #992
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great having you contribute to this project
Welcome to the community 🤓If you would like to continue contributing to open source and would like to do it with an awesome inclusive community, you should join our Discord chat and our GitHub Organisation - we help and encourage each other to contribute to open source little and often 🤓 . Any questions let us know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, that makes sense! Thanks for spotting the need for a key press and adding it in. LGTM!
Hey, can you remove line no 29 and check if it is significant |
Actually line 29 is rather useless. With or without it functionality seems to work fine both on homepage and on profile page. |
Being the creator of the scroll-to-top-btn, I think that line no.29 should be erased because I don't remember the grounds on which I included it. |
Yes, go ahead and remove it if it’s not serving any purpose |
I removed the unnecessary line. |
Closes #990
Simply adding tabIndex attribute to the button did not work in the sense that pressing Enter did not trigger the function.
My solution was to add onKeyPress attribute to the button and pass it the same function as for onClick.
This of course meant that I had to make sure that only pressing 'Enter' and clicking on the button trigger that function.
Hence the condition.