Add rule for don't show tooltip when dropdown is open. Closes #5194

This commit is contained in:
Tainan Felipe Pauli de Almeida 2018-03-29 10:40:50 -03:00
parent b618f7035b
commit bef61eeeda

View File

@ -18,6 +18,14 @@ const defaultProps = {
};
class Tooltip extends Component {
static wait(show, event) {
const tooltipTarget = event.target;
const expandedEl = tooltipTarget.parentElement.querySelector('[aria-expanded="true"]');
const isTarget = expandedEl === tooltipTarget;
if (expandedEl && !isTarget) return;
show();
}
constructor(props) {
super(props);
@ -40,12 +48,11 @@ class Tooltip extends Component {
delay: this.delay,
onShow: this.onShow,
onHide: this.onHide,
wait: Tooltip.wait,
touchHold: true,
};
this.tooltip = Tippy(`#${this.tippySelectorId}`, options);
}
onShow() {
document.addEventListener('keyup', this.handleEscapeHide);
}
@ -56,7 +63,6 @@ class Tooltip extends Component {
handleEscapeHide(e) {
if (e.keyCode !== ESCAPE) return;
this.tooltip.tooltips[0].hide();
}