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

Docs: Usage of Popover with Accordion #1556

Open
superstes opened this issue Mar 18, 2025 · 0 comments
Open

Docs: Usage of Popover with Accordion #1556

superstes opened this issue Mar 18, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@superstes
Copy link
Contributor

superstes commented Mar 18, 2025

Summary

It would be nice if the docs mentioned that the triggeredBy might not work cleanly if the target element is dynamically created.

Basic example

Working:

<Accordion>
    <AccordionItem>
        <Button id="insideID">Inside</Button>
        <Popover triggeredBy="#insideID">TEST INSIDE</Popover>
    </AccordionItem>
</Accordion>

NOT Working:

<Accordion>
    <AccordionItem>
        <Button id="middleID">Middle</Button>
        <Button id="outsideID">Outside</Button>
    </AccordionItem>
    <Popover triggeredBy="#middleID">TEST MIDDLE</Popover>
</Accordion>
<Popover triggeredBy="#outsideID">TEST OUTSIDE</Popover>

We see the console error No triggers found..

Motivation

This behavior is somewhat unintuitive but the error is logical.

If there is no way around this problem - it would be nice for it to be added to the popover-component docs.

The Popover internally seems to use utils/Popper.svelte that queries for the target-HTML-element on mount. (which might not yet exist)
See: https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/utils/Popper.svelte#L141

Seems to be related: #1389, #1386

@superstes superstes added the enhancement New feature or request label Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant