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

Modify trigger: 'mouseenter click' behaviour. #659

Merged
merged 4 commits into from Dec 28, 2019
Merged

Modify trigger: 'mouseenter click' behaviour. #659

merged 4 commits into from Dec 28, 2019

Conversation

mattsbennett
Copy link
Contributor

@mattsbennett mattsbennett commented Dec 15, 2019

This is an implementation proposal for the changes required for the behaviour change proposed at #649. Currently, the mouseenter behaviour always overrides the click behaviour. At a high-level, the behaviour change here amounts to respecting the mouseenter behaviour only until the reference element is clicked. Then, the existing click behaviour is respected, until the tippy is hidden (e.g. as per hideOnClick = true || 'toggle'). Once hidden again, the existing mouseenter behaviour is respected once more.

Lower-level description:

  • When both mouseenter and click triggers are specified, respect existing mouseenter behaviour until reference element is clicked.
  • On click, show the tippy and no longer hide on mouseleave.
  • Respect all pre-existing hideOnClick behaviour (true, false, 'toggle').
  • Only toggle the tippy on clicking the reference element when hideOnClick='toggle' (currently the tippy is always toggled on click (unless hideOnClick is set to false). This conflicts with the preceding point, hence removed (see discussion below).

- When both triggers, use mouseenter behaviour until reference element click.
- On click, show the tippy, no longer hide on mouseleave.
- Respect all pre-existing hideOnClick behaviour (true, false, 'toggle').
- Only toggle the tippy on clicking the reference element when hideOnClick='toggle'.
@mattsbennett mattsbennett changed the title Modify trigger: 'mouseenter click' behaviour and update related test. Modify trigger: 'mouseenter click' behaviour. Dec 15, 2019
@atomiks
Copy link
Owner

atomiks commented Dec 18, 2019

Thanks for the PR! Sorry for the delay, I will try and check this tonight.

@atomiks
Copy link
Owner

atomiks commented Dec 18, 2019

This is almost good, just hideOnClick: true (default) doesn't hide the tippy on the second click. Then it should be toggle-able.

hideOnClick: "toggle" just means it can be toggled by clicking the ref element, but not clicking outside. In this context they should work the same.

@mattsbennett
Copy link
Contributor Author

Ah, right - thank you for the feedback! I'll get back to this ASAP (probably the weekend).

…d toggle the tippy).

- Also, add an assertion to test that the tippy does not hide onmouseleave when the mouseenter and click triggers are specified, and the tippy has been shown via click.
@mattsbennett
Copy link
Contributor Author

Alright, I've addressed the hideOnClick: true issue @atomiks !

@atomiks
Copy link
Owner

atomiks commented Dec 27, 2019

Edit: nvm it works! The changes didn't get pulled in properly.

src/createTippy.ts Outdated Show resolved Hide resolved
@mattsbennett
Copy link
Contributor Author

Thanks for the review! I've made that renaming change.

@atomiks atomiks merged commit c0a40de into atomiks:master Dec 28, 2019
@atomiks
Copy link
Owner

atomiks commented Dec 28, 2019

Thanks a lot!

@mattsbennett
Copy link
Contributor Author

You bet!

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

Successfully merging this pull request may close these issues.

None yet

2 participants