Skip to content

Commit

Permalink
Fixed #1806 - Tooltip does not disappear when components are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Feb 25, 2021
1 parent 432ced0 commit 1c14ddd
Show file tree
Hide file tree
Showing 22 changed files with 43 additions and 42 deletions.
4 changes: 2 additions & 2 deletions src/components/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,9 @@ export class AutoComplete extends Component {
this.updateInputField(this.props.value);
}

if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export class ButtonComponent extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ export class Calendar extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ export class Checkbox extends Component {
componentDidUpdate(prevProps) {
this.input.checked = this.props.checked;

if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ export class Chips extends Component {
componentDidUpdate(prevProps) {
let isValueSame = this.props.value && prevProps.value && prevProps.value.length === this.props.value.length;
if (this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/colorpicker/ColorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@ export class ColorPicker extends Component {

componentDidUpdate(prevProps) {
this.updateUI();
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,9 +671,9 @@ export class Dropdown extends Component {
}
}

if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/inputmask/InputMask.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ export class InputMask extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,9 @@ export class InputNumber extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/inputswitch/InputSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ export class InputSwitch extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/inputtext/InputText.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ class InputTextComponent extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/inputtextarea/InputTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ export class InputTextarea extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/listbox/ListBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ export class ListBox extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/multiselect/MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,9 @@ export class MultiSelect extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/password/Password.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ export class Password extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/radiobutton/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ export class RadioButton extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/rating/Rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export class Rating extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/selectbutton/SelectButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ export class SelectButton extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/splitbutton/SplitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ export class SplitButton extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/togglebutton/ToggleButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ export class ToggleButton extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down
1 change: 1 addition & 0 deletions src/components/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function tip(props) {
ReactDOM.unmountComponentAtNode(tooltipWrapper);
},
updateContent: (newContent) => {
console.warn("The 'updateContent' method has been deprecated on Tooltip. Use update(newProps) method.");
updateTooltip({ content: newContent });
},
update: (newProps) => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/tristatecheckbox/TriStateCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ export class TriStateCheckbox extends Component {
}

componentDidUpdate(prevProps) {
if (prevProps.tooltip !== this.props.tooltip) {
if (prevProps.tooltip !== this.props.tooltip || prevProps.tooltipOptions !== this.props.tooltipOptions) {
if (this.tooltip)
this.tooltip.updateContent(this.props.tooltip);
this.tooltip.update({ content: this.props.tooltip, ...(this.props.tooltipOptions || {}) });
else
this.renderTooltip();
}
Expand Down

0 comments on commit 1c14ddd

Please sign in to comment.