Commit 5181c8f7 authored by Esmael El-Moslimany's avatar Esmael El-Moslimany Committed by Commit Bot

Settings WebUI: site list, keep tooltip visible within offsetParent

Bug: 899183
Change-Id: I36a9c92556215d79bc40dbe9aed6ec8f1d5fa5c1
Reviewed-on: https://chromium-review.googlesource.com/c/1315627Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Esmael El-Moslimany <aee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605027}
parent 4a67575e
...@@ -78,7 +78,8 @@ ...@@ -78,7 +78,8 @@
</iron-list> </iron-list>
</div> </div>
</div> </div>
<paper-tooltip id="tooltip" manual-mode position="top"> <paper-tooltip id="tooltip" fit-to-visible-bounds manual-mode
position="top">
[[tooltipText_]] [[tooltipText_]]
</paper-tooltip> </paper-tooltip>
<template is="dom-if" if="[[showEditExceptionDialog_]]" restamp> <template is="dom-if" if="[[showEditExceptionDialog_]]" restamp>
......
...@@ -242,8 +242,15 @@ Polymer({ ...@@ -242,8 +242,15 @@ Polymer({
// potential targets. Since paper-tooltip does not expose a public property // potential targets. Since paper-tooltip does not expose a public property
// or method to update the target, the private property |_target| is // or method to update the target, the private property |_target| is
// updated directly. // updated directly.
this.$.tooltip._target = target; const tooltip = this.$.tooltip;
/** @type {{updatePosition: Function}} */ (this.$.tooltip).updatePosition(); /** @type {{updatePosition: Function}} */ (tooltip).updatePosition();
tooltip._target = target;
const parentRect = tooltip.offsetParent.getBoundingClientRect();
const rect = tooltip.getBoundingClientRect();
if (parentRect.left + parentRect.width < rect.left + rect.width) {
tooltip.style.right = '0';
tooltip.style.left = 'auto';
}
const hide = () => { const hide = () => {
this.$.tooltip.hide(); this.$.tooltip.hide();
target.removeEventListener('mouseleave', hide); target.removeEventListener('mouseleave', hide);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment