-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Fix popover issues with hover display. #13104
Conversation
…it to show on hover. Fix issue with popover timer still running when button clicked and parent element no longer visible (e.g. keepalive component).
Deploy preview for element ready! Built with commit fbfd588 |
I'm not sure why but the Travis build says it's still in progress even when the details show that it completed successfully. Hope this doesn't block merge. |
The failure of the test seems to be completely unrelated to the change I made since I only edited the documentation which was missing some format options which are supported in utils/date.js |
Which issue does this pr fix? Could you please provide a demo? |
The first issue is simply demonstrated:
Expected: you need to hover over the button for 5000ms before the popover shows and there is no way to show the popover before the open delay is complete. The second issue is slightly more work. Set up your router to have a page kept alive:
Now in the
Expected: when you click the button, the popover will not show. |
Is it possible to get this merged soon? I have a project going into beta testing shortly and without this bugfix it leaves a popover from the previous page showing, as previously described. The attached video shows both the problems:
My pull request fixes both of these issues. |
add a issue link: https://jsfiddle.net/dpc78qb4/ |
* Fix issue with popover displaying on focus when configuration is for it to show on hover. Fix issue with popover timer still running when button clicked and parent element no longer visible (e.g. keepalive component). * Updated to pass tests * Correct documentation for el-date-picker * Changes as per ziyoung review
* Fix issue with popover displaying on focus when configuration is for it to show on hover. Fix issue with popover timer still running when button clicked and parent element no longer visible (e.g. keepalive component). * Updated to pass tests * Correct documentation for el-date-picker * Changes as per ziyoung review
There are two issues addressed in this pull request:
When the trigger is set to "hover", the popover is also triggered on focus, which is incorrect behaviour. Fixed by setting the handling of handleFocus and handleBlur to just show/hide the popover when the trigger is set to "click" or "focus".
When the trigger is set to "hover" the timer is established on hover, but if the thing that you are hovering over is a button that you click to go to another page, then the timer is not cleared. The issue with this is most visible if the component is a keepalive one, so it is not destroyed. The timer fires after the page is gone, leaving a rogue popover at the top of the page.
I therefore implemented a "beforeDestroy" function and "deactivated" function to handle both keepalive and non keepalive components. Both of these call the cleanup function which cancels the timer and makes sure the popover isn't displayed.