-
Notifications
You must be signed in to change notification settings - Fork 88
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
adding event listener to close navbar dropdown #464
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 works as mentioned.
But the dropdown does not close if you click the navbar anywhere other than the X button. Was that intended? If yes, then it's ok.
Otherwise, you can update for that too.
Hey, It was not intentional. I have fixed it. |
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 works as mentioned, but there might be a couple of things that you can improve.
- In the
handleClose
function, the event parameter is declared ase: Event
. It would be more specific and accurate to specify the actual event type we are expecting.
e.g.
(e: MouseEvent) => {
- In the
useEffect
hook, the dependency array includeshandleClose
and toggle. It's generally recommended to only include variables or functions that are directly used inside the effect. SincehandleClose
is a callback function created withuseCallback
, its reference won't change unless its dependencies change. Therefore, you can omit it if you want from the dependency array to avoid unnecessary effect re-executions.
e.g.
}, [toggle]);
@s2sharpit
What do you think on this?
Hey @Anmol-Baranwal धन्यवाद 😊 |
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.
🚀 Looks clean to me.
@s2sharpit Also, it's best to use English instead of Hindi in your responses since not everyone may understand Hindi. Using a widely accessible language like English keeps things professional. |
Thank you, @Anmol-Baranwal, for your feedback and suggestion! I really appreciate your effort in helping me improve as a contributor. I will definitely check out the Conventional Commits guidelines you shared. |
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.
LGTM ✅
Hi @vinzvinci @Anmol-Baranwal @thehashmap , |
We will soon get this done. Kindly wait. |
Related Issue
Closes: #459
Describe the changes you've made
Enhance the profile dropdown functionality to automatically close when the user scrolls or clicks anywhere within the active window, providing a seamless and intuitive user experience.
Type of change
What sort of change have you made:
How Has This Been Tested?
Checklist
Screenshots (if applicable)
Code of Conduct