JosephusPaye / Keen-UI

A lightweight Vue.js UI library with a simple API, inspired by Google's Material Design.
https://josephuspaye.github.io/Keen-UI/
MIT License
4.1k stars 437 forks source link

UiButton tooltip when disabled #469

Open EmilMoe opened 5 years ago

EmilMoe commented 5 years ago

I noticed that the tooltip is only working when the button is not disabled? What's the reason behind this?

My save button is disabled until the form is valid, but I would like to display a tooltip saying something about this.

If there's a good reason not to have the tooltip, I don't want to propose a PR

hyvyys commented 4 years ago

The tooltip doesn't show up because the root node of UiButton is a <button> (a poor choice imho), and a disabled button doesn't get any mouse events.

The workaround is to wrap your UiButton in another element and let that be the tooltip toggle. But I'm having issues with this when using tooltip with v-if...

sysebert commented 4 years ago

you can use a title on it which should do what you want?

<button title="I still work when disabled" disabled>Button Text</button>

https://jsbin.com/riwulemehe/edit?html,output

EmilMoe commented 4 years ago

That's not really what I wanted as I wanted to keep the UI

sysebert commented 4 years ago

I was just using "button" as a placeholder for whatever you ended up naming your component.

import UiButton from 'keen-ui/lib/UiButton';

Vue.component('ui-button', UiButton);
<template>
  <ui-button
    color="primary"
    title="I still work when disabled"
    type="primary"
    disabled>
    Button Text
  </ui-button>
</template>
hyvyys commented 4 years ago

What we're after is to keep the UiTooltip as well. Does applying title do that?

pt., 20 mar 2020, 00:56 użytkownik sysebert notifications@github.com napisał:

I was just using "button" as a placeholder for whatever you ended up naming your component.

import UiButton from 'keen-ui/lib/UiButton'; Vue.component('ui-button', UiButton);

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JosephusPaye/Keen-UI/issues/469#issuecomment-601469210, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE6ZWLQMED6MGTV2C763363RIKWLVANCNFSM4I3N3HIQ .