Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Tooltip/popover as menu (different opening and closing events) #2863

Closed
davidpelayo opened this issue Oct 21, 2014 · 3 comments
Closed

Tooltip/popover as menu (different opening and closing events) #2863

davidpelayo opened this issue Oct 21, 2014 · 3 comments

Comments

@davidpelayo
Copy link

From what I need, I've realised we can refactor a bit the code to support the popover concept be used like a menu component.

In my case, I need a scenario where given a certain div, by declaring it as popover, it would be nice to set an option to make the popover behaves like a menu component. Meaning it needs to be opened with different events simultaneously (like mouseenter as well as click/focus), while closing should be defined when clicking or, complementary, when mouseleaving the div area or the menu (children div) area.

Do you think it would be possible to manage to have anything similar to this? Thanks.

@pkozlowski-opensource
Copy link
Member

Yes, this is basically a question about supporting programmatic triggers, which we've got on the roadmap.

@davidpelayo
Copy link
Author

To me, in my case, with what I wanted to achieve, it's doable by adding just four loc at $tooltip's level.

Concretely, inside function show() {, I added after scope.$digest(); the following:

if (triggers.hide === 'click') { elements.next().bind( 'mouseleave', hideTooltipBind); }

Why here and not when building? Because the list of elements (to my case I added unsafely a ul markup to show on the popover) must be first already rendered.

To unbind the event, in function hide() { after popupTimeout = null; I just added:
element.next().unbind( 'mouseleave', hideTooltipBind);

Which, at the end, allowed me to close the popover not only when clicked on the initial popover related element but also when visited (hovered) the popover and then leaved that area.

Any better suggestion? It would be nice to add a directive or similar to control this specific behaviour in a better and cleaner way.

@icfantv
Copy link
Contributor

icfantv commented Aug 6, 2015

Closing as duplicate of #590.

@icfantv icfantv closed this as completed Aug 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants