Skip to content
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

Focus and blur listener is conflict with 'hover' trigger mode #114

Closed
vq0599 opened this issue Aug 27, 2019 · 6 comments · Fixed by #115
Closed

Focus and blur listener is conflict with 'hover' trigger mode #114

vq0599 opened this issue Aug 27, 2019 · 6 comments · Fixed by #115

Comments

@vq0599
Copy link
Contributor

vq0599 commented Aug 27, 2019

Hi,
When using hover mode, If the popper content includes a link <a href="#">click me</a> and reference element is focus, the link can't be clicked because the blur event will close the popper firstly.

This is a example https://jsfiddle.net/aLuroykm/4/

See #48. Why not add a new trigger mode 'focus' ?

Thanks for your awesome plugin.

@vq0599 vq0599 changed the title focus and blur listener is conflict with 'hover' trigger mode Focus and blur listener is conflict with 'hover' trigger mode Aug 27, 2019
@RobinCK
Copy link
Owner

RobinCK commented Aug 27, 2019

@vq0599
Copy link
Contributor Author

vq0599 commented Aug 27, 2019

Sorry, Perhaps I have not expressed myself very well.

  1. It's ok.
    Aug-27-2019 15-42-59

  2. The link unable be clicked, because blur event be triggered before click event.
    Aug-27-2019 15-43-08

@RobinCK
Copy link
Owner

RobinCK commented Aug 27, 2019

unfortunately, I don’t have time to edit the component itself, but the problem can be solved somehow https://jsfiddle.net/3qsac2up/3/

@vq0599
Copy link
Contributor Author

vq0599 commented Aug 27, 2019

Thanks.
How about adding a new trigger mode 'focus' and removing focus and blur listener on 'hover' mode?
Refer https://ant.design/components/tooltip/
Can I submit a PR?

      switch (this.trigger) {
        case 'click':
          on(this.referenceElm, 'click', this.doToggle);
          on(document, 'click', this.handleDocumentClick);
          break;
        case 'hover':
          on(this.referenceElm, 'mouseover', this.onMouseOver);
          on(this.popper, 'mouseover', this.onMouseOver);
          on(this.referenceElm, 'mouseout', this.onMouseOut);
          on(this.popper, 'mouseout', this.onMouseOut);
          break;
        case 'focus':
          on(this.referenceElm, 'focus', this.onMouseOver);
          on(this.popper, 'focus', this.onMouseOver);
          on(this.referenceElm, 'blur', this.onMouseOut);
          on(this.popper, 'blur', this.onMouseOut);
      }

@RobinCK
Copy link
Owner

RobinCK commented Aug 27, 2019

Yes you can do PR

@ouba421
Copy link

ouba421 commented Oct 12, 2019

Click on the popup and close the popover!
image
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants