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

bug(tooltip): triggers are global for all tooltips #692

Closed
@Hviid

Description

@Hviid

In the tooltip directive the following are set "globally" in the directive and not in the returned "instance".

var triggers = setTriggers( undefined );

UPDATE:
Because triggers are set as a variable in the tooltip function and not in the returned obj, then "triggers" are shared accross all tooltips. Which for instance won't work as expected in the following.

attrs.$observe( prefix+'Trigger', function ( val ) {
  element.unbind( triggers.show );
  element.unbind( triggers.hide );

  triggers = setTriggers( val );

  if ( triggers.show === triggers.hide ) {
    element.bind( triggers.show, toggleTooltipBind );
  } else {
    element.bind( triggers.show, showTooltipBind );
    element.bind( triggers.hide, hideTooltipBind );
  }
});

tooltip1 and tooltip2 might here had bound show to "mouseover".
Then when triggers are updated by tooltip1 to say "click", then tooltip2 won't get "mouseover" unbound, when it's trigger attribute gets changed, because triggers.show will resolve to "click" and not "mouseover".

Proposed fix is to move:

var triggers = setTriggers( undefined );

into the returned obj, so the variable is locale to the individuale tooltip.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions