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

Provide an easy way to enable pointer events on tippy bubbles #1163

Open
DonaldDuck313 opened this issue Apr 7, 2024 · 0 comments
Open

Provide an easy way to enable pointer events on tippy bubbles #1163

DonaldDuck313 opened this issue Apr 7, 2024 · 0 comments

Comments

@DonaldDuck313
Copy link

Problem

I have a tippy bubble to which I've added a button:

const bubble = tippy("#someElement", {
    content: "<button id=\"myButton\">Click here</button>",
    allowHTML: true,
    showOnCreate: true,
    trigger: "manual",
    hideOnClick: false
});
document.querySelector("#myButton").onclick = () => alert("Do stuff");

The problem is that by default tippy bubbles have the CSS attribute pointer-events: none, so clicking the button does nothing. The only way I've found to get around this limitation is to manually select the bubble and change the CSS, which I find very ugly:

[...document.querySelectorAll("[data-tippy-root]")].at(-1).style.pointerEvents = "auto";

Solution

It would be nice if you could add an option to the tippy function that enables pointer events, so that I could do something like:

const bubble = tippy("#someElement", {
    content: "<button id=\"myButton\">Click here</button>",
    allowHTML: true,
    showOnCreate: true,
    trigger: "manual",
    hideOnClick: false,
    usePointerEvents: true    //Not currently possible, could you please add support for this?
});
document.querySelector("#myButton").onclick = () => alert("Do stuff");
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

1 participant