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

Nested titles confuse powertip #188

Open
dertuxmalwieder opened this issue Feb 1, 2024 · 2 comments
Open

Nested titles confuse powertip #188

dertuxmalwieder opened this issue Feb 1, 2024 · 2 comments
Labels
Bug Software defects or other problems that should be fixed.

Comments

@dertuxmalwieder
Copy link

The library does not seem to have a detection of nested HTML elements with titles, it seems.

Minimal example:

<!doctype html>
<html>
    <head>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/jquery-powertip@1.3.2/dist/jquery.powertip.min.js"></script>
        <link href="https://cdn.jsdelivr.net/npm/jquery-powertip@1.3.2/dist/css/jquery.powertip.min.css" rel="stylesheet" />
        <script type="text/javascript">
            $(document).ready(function() {
              // Fire up PowerTip:
              $("[title]").powerTip({ smartPlacement: true });
            });
        </script>
    </head>
    <body>
        <ul>
            <li title="parent">
                Parent element
                <ul>
                    <li title="child">Child element</li>
                </ul>
            </li>
        </ul>
    </body>
</html>

You might see how hovering the child element confuses the tooltip.

@stevenbenner
Copy link
Owner

Thank you for the bug report. As well as the helpful test case.

I can reproduce this issue with your example code. Placing the mouse cursor over the child element causes the tooltip for the child to open, then close, then the tooltip for the parent opens.

I believe that this particular case is event bubbling causing the parent to be queued after the child. I could probably just capture or stop bubbling. I'll look into it.

@stevenbenner stevenbenner added the Bug Software defects or other problems that should be fixed. label Feb 13, 2024
@dertuxmalwieder
Copy link
Author

Thank you. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Software defects or other problems that should be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants