AXeL-dev / distract-me-not

:no_entry: A lightweight website blocker with a user friendly interface
https://addons.mozilla.org/addon/distract-me-not/
MIT License
122 stars 14 forks source link

unblock-diaog not taking registering "Enter" keypress to trigger unblock functionality #103

Closed itSarthak closed 1 week ago

itSarthak commented 1 week ago

I am a long time user of this extension and I absolutely love because it just works. But the problem I face daily is when I have to unblock a site for a while. In unblock-dialog, after setting the time I want the site to be unblocked, I press enter but it doesn't do anything which is frustrating because it's very common for applications to register enter event.

Your environment

Steps to reproduce

  1. Blacklist a site, you can try blacklisting youtube.com
  2. Open youtube.com
  3. You will be greeted with the Blocked Page image
  4. Click UNBLOCK button and then this window will popup. Choose any option. image
  5. Press ENTER, nothing happens

Expected behaviour

ENTER keyword should trigger the unblock functionality. Whatever option was selected and the value from radiogroup should be saved and unblock-dialog should close down

Actual behaviour

Currently, nothing of that sort happens because there's no onKeyDown event added in RadioGroup currently.

AXeL-dev commented 1 week ago

Hello @itSarthak,

Thank you for taking the time to submit the feature request. I do agree that the keyboard accessibility is missing in many parts of the extension, i'll try to find some time to implement it or maybe if any contributor is interested into working on it, that would be helpful.

I will let you know in case i have some news. Thanks again.

itSarthak commented 1 week ago

Hey @AXeL-dev , Glad to hear your response on this and I would like to work on this functionality. I think all we have to do is to add an onKeyDown event listener for ENTER key? Why don't I try submitting a pr for this issue, it will only be 3 lines at max.

AXeL-dev commented 1 week ago

Hey @AXeL-dev , Glad to hear your response on this and I would like to work on this functionality. I think all we have to do is to add an onKeyDown event listener for ENTER key? Why don't I try submitting a pr for this issue, it will only be 3 lines at max.

Alright, that's pretty cool, your PR looks good to me, i'll merge it & test it before creating a new release.

AXeL-dev commented 1 week ago

@itSarthak After testing i noticed that the onKeyDown event was not called, and this is likely due to the fact that it is only registered on the RadioGroup component, so i simply moved it to the dialog container props and now everything seems to work as expected.

The fix is now deployed in version 2.8.2, let me know once you test it & thank you for your valuable contribution! 🎉

itSarthak commented 1 week ago

@AXeL-dev Your response is really appreciated. I can see why it happened, please accept my apologies for not testing it thoroughly. I am still new to open source and figuring out my way into it. I tested the functionality and it is working like a charm, thank you so much for making time to fix it.

AXeL-dev commented 1 week ago

@AXeL-dev Your response is really appreciated. I can see why it happened, please accept my apologies for not testing it thoroughly. I am still new to open source and figuring out my way into it.

That's okay, you don't have to worry about it, you did a great job all the way through.

I tested the functionality and it is working like a charm, thank you so much for making time to fix it.

Absolutely welcome, and i wanna thank you back for your contribution, it's quite rare to find people interested in contributing to the project, the most of people just make feature or bug requests and later they may complain if their requests are not yet resolved, so yeah it was a pleasure to see your contribution and good luck for the rest.

itSarthak commented 1 week ago

I am a long time user of this extension and it was really motivating to work on something I use daily. Thank you for such nice words, I will be looking forwards for the upcoming features.