Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

Popover/tooltip positioning with text overflow container #5894

@peterreisz

Description

@peterreisz

In html tables if you want to add a tooltip/popover for a long cell (with overflow: hidden option) the UIB using the whole content for positioning the tooltip/popover. The result is the tooltip/popover seems to be on a different cell or not in the middle of the actual cell of the html table.

image

See the example here: http://plnkr.co/edit/UUyCbS2EfN62Z1QsLhXO?p=preview
Hover on the first cell.

Versions:

Angular: 1.5.5
UIBS: 1.3.2
Bootstrap: 3.3.6

I've needed a fast runtime patch for my project, so I used the following decorator, it might be useful.

$provide.decorator('$uibPosition', function($delegate) {

    var orgPositionElements = $delegate.positionElements;

    $delegate.positionElements = function(hostElem, targetElem, placement, appendToBody) {
        var originalPosition = orgPositionElements.call($delegate, hostElem, targetElem, placement, appendToBody);
        var parent = hostElem.parent()[0];
        if ((hostElem.attr('uib-popover') || hostElem.attr('uib-tooltip'))
                && hostElem.parent()[0].tagName == 'TD' && parent.scrollWidth > parent.clientWidth) {
            var newPosition = orgPositionElements.call($delegate, hostElem.parent(), targetElem, placement, appendToBody);
            newPosition.top = originalPosition.top;

            return newPosition;
        }

        return originalPosition;
    }

    return $delegate;
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions