Skip to content

Commit

Permalink
Merge pull request #2139 from cfpb/provide-tt-obj
Browse files Browse the repository at this point in the history
Provide instantiated tooltip object on initialized component
  • Loading branch information
wpears authored Jan 8, 2025
2 parents b3cc8e9 + 72163a3 commit 2a80be5
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function Tooltip(element) {

/**
* Set up and create the tooltip.
* @returns {Tooltip} An instance.
* @returns {object} An initialized tippy tooltip instance.
*/
function init() {
return tippy(element, {
return (this.tooltip = tippy(element, {
theme: 'cfpb',
maxWidth: 450,
content: function (reference) {
Expand Down Expand Up @@ -63,11 +63,12 @@ function Tooltip(element) {
},
},
],
});
}));
}

// Attach public events.
this.init = init;
this.tooltip = null;

return this;
}
Expand Down

0 comments on commit 2a80be5

Please sign in to comment.