Skip to content

Tooltip: fix forceUpdate when component previously lacked data-tooltip

Warren Gifford requested to merge fix-tooltip-forceupdate into master

Created by: sqs

A common use case for a tooltip is to show a tooltip on a button and change the tooltip's contents when the button is pressed (e.g., from Enable line wrapping to Disable line wrapping).

Because this Tooltip component uses global state instead of the React component hierarchy (e.g., passing a setTooltip(anchor: HTMLElement, content: string): void func to every component), it is necessary to call the static class method Tooltip.forceUpdate() when the button's tooltip changes.

There was a bug where if the button lacked a data-tooltip attribute and then added one, Tooltip.forceUpdate() would not show the new tooltip. This commit fixes that bug.

Merge request reports

Loading