Skip to content

Nested titles confuse powertip #188

Open
@dertuxmalwieder

Description

@dertuxmalwieder

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.

Activity

stevenbenner

stevenbenner commented on Feb 13, 2024

@stevenbenner
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.

added
BugSoftware defects or other problems that should be fixed.
on Feb 13, 2024
dertuxmalwieder

dertuxmalwieder commented on Feb 13, 2024

@dertuxmalwieder
Author

Thank you. :-)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSoftware defects or other problems that should be fixed.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @dertuxmalwieder@stevenbenner

        Issue actions

          Nested titles confuse powertip · Issue #188 · stevenbenner/jquery-powertip