Skip to content

Commit

Permalink
Update tooltip positioning when content updates (#1116)
Browse files Browse the repository at this point in the history
* Update tooltip positioning when content updates

* changelog
  • Loading branch information
chandlerprall authored Aug 29, 2018
1 parent 16ff2df commit 39c94c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
**Bug fixes**

- Fixed `onChange` typedef on `EuiSwitch` ([#1144](https://github.com/elastic/eui/pull/1144)
- Fixed `EuiToolTip`'s inability to update its position when tooltip content changes ([#1116](https://github.com/elastic/eui/pull/1116))

## [`3.7.0`](https://github.com/elastic/eui/tree/v3.7.0)

Expand Down
8 changes: 7 additions & 1 deletion src/components/tool_tip/tool_tip.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { EuiToolTipPopover } from './tool_tip_popover';
import { findPopoverPosition } from '../../services';

import makeId from '../form/form_row/make_id';
import { EuiMutationObserver } from '../mutation_observer';

const positionsToClassNameMap = {
top: 'euiToolTip--top',
Expand Down Expand Up @@ -181,7 +182,12 @@ export class EuiToolTip extends Component {
{...rest}
>
<div style={arrowStyles} className="euiToolTip__arrow"/>
{content}
<EuiMutationObserver
observerOptions={{ subtree: true, childList: true, characterData: true, attributes: true }}
onMutation={this.positionToolTip}
>
{content}
</EuiMutationObserver>
</EuiToolTipPopover>
</EuiPortal>
);
Expand Down

0 comments on commit 39c94c1

Please sign in to comment.