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

UITooltip doesn't work inside some VueComponents #204

Closed
mcmillenb opened this issue Feb 2, 2017 · 9 comments
Closed

UITooltip doesn't work inside some VueComponents #204

mcmillenb opened this issue Feb 2, 2017 · 9 comments

Comments

@mcmillenb
Copy link

I tried to add a <ui-tooltip> to a <ui-button> like so:

<ui-button ref="edit-btn">
  Edit
  <ui-tooltip trigger="edit-btn">
    Select an element to edit
  </ui-tooltip>
</ui-button>

And get an error:

Tooltip Error: You must provide a target for Tooltip to attach to

The problem is in UiTooltip.vue:

The initialize() method creates a new Tooltip object, passing this.$parent.$refs[this.trigger], as the target. However, the UiButton template wraps the content of the button in a div, so this.$parent is that wrapper div, and not the root element containing the ref value.

This is my workaround for now:

<div ref="edit-btn">
  <ui-button>
    Edit
  </ui-button>
  <ui-tooltip trigger="edit-btn">
    Select an element to edit
  </ui-tooltip>
</div>
@EmilMoe
Copy link
Contributor

EmilMoe commented Feb 3, 2017

This is how it's supposed to work to my understanding. You don't wrap a tooltip inside a button, the button just activates it.

@mcmillenb
Copy link
Author

No, I don't think so. Unless you mean tooltips for ui-button components specifically are handled differently?

ui-tooltip components affect their parent element. See the docs source code:

<div class="image-pane" ref="image" :style="{ 'background-image': 'url(' + image + ')' }">
    <ui-tooltip trigger="image" :position="tooltipPosition">{{ name }}</ui-tooltip>
</div>

@lavezzi1
Copy link

lavezzi1 commented Apr 23, 2017

UiTooltip doesn't work inside Ui-Tabs and v-for

@zdpeitang
Copy link

same issue, even workaround doesn't work for me.

@lavezzi1
Copy link

Any workaround or solution for that issue mr. @JosephusPaye ?

@JosephusPaye
Copy link
Owner

This has been fixed in d8edc31.

The workaround @mcmillenb posted can be used until the next version.

@hakobtorosyan
Copy link

hakobtorosyan commented Jan 16, 2018

Hi all.I have ui-tooltip inside for loop.It doesn' t work.Have anybody solution for it?

@JosephusPaye
Copy link
Owner

JosephusPaye commented Jul 31, 2018

In the upcoming version, you can also use a CSS selector for the trigger:

<ui-button id="edit-btn">Edit</ui-button>
<ui-tooltip trigger="#edit-btn">Select an element to edit</ui-tooltip>

To try it:

# npm
npm install keen-ui@JosephusPaye/Keen-UI#next

# yarn
yarn add keen-ui@JosephusPaye/Keen-UI#next

See the changelog for all changes.

@JosephusPaye
Copy link
Owner

Released in v1.1.0.

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

No branches or pull requests

6 participants