Add option the popup to close on mouseleave
Closes #123
Test URLs
https://github.com/
Screenshot


Note to reviewers
I use .removeAttribute('open') to close the dropdown.
Thank you! I’ll make sure it works correctly soon
I made a change so that the popup close gets canceled if you re-mousenter quick enough, within 1 sec (1000 ms) (and updated the screenshot in the OP).
Hi @fregante Is there any way I can assist you in making the PR complete ?
Some notes:
-
About the popup closing to be canceled if you re-mousenter quick enough, the interval I currently have is 1000 msec, but I think it should be 500 msec. What do you think?
-
If I click a "Mark as done" and then move the mouse away so that the popup gets closed, then if I move the mouse to reopen the popup, clicking another "Mark as done" unfortunately causes the relevant "Marked x notifications as read" message to be displayed multiple times: e.g.
So, I tried changing removeAttribute()intoremove()the popup altogether + reopening it (see code below) but unfortunately the issue remains:using
remove():if (options.closeOnMouseleave) { let timer; select('.NPG-dropdown').addEventListener('mouseleave', () => { // timer = setTimeout(closeDropdown, 500); timer = setTimeout(() => {closeDropdown(); createNotificationsDropdown();}, 500); }); select('.NPG-dropdown').addEventListener('mouseenter', () => { clearTimeout(timer); }); } // ... function closeDropdown() { // select('.NPG-container[open]').removeAttribute('open'); select('.NPG-container').remove(); }
Thank you! I’ll make sure it works correctly soon
@fregante Have you changed your mind? Do you find this PR is not salvageable? Should I close this?
I've been on Safari for a year and I haven't used some of my extensions since 😅 so you can just leave this open until someone reviews it