Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tooltip): DSSINBOX-4 resolve tooltip not removing #1814

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/sage-system/lib/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@ Sage.tooltip = (function() {
// TODO: Reverting tooltip reveal on focus/blur until further investigation of persistent focus
// can resolve it lingering when it shouldn't.

function init(el) {
function init(el, onClick) {
el.addEventListener("mouseenter", buildToolTip);
// el.addEventListener("focus", buildToolTip);
el.addEventListener("mouseleave", removeTooltip);
el.addEventListener("click", function(ev) {
removeTooltip(ev);
if (onClick) {
onClick(ev);
}
});
// el.addEventListener("blur", removeTooltip);
}

Expand Down Expand Up @@ -50,7 +56,7 @@ Sage.tooltip = (function() {

// Removes tooltip from DOM
function removeTooltip(evt) {
if (!evt.target.hasAttribute(DATA_ATTR) || !document.querySelector(SELECTOR) || !evt.target.dataset.jsTooltip) return;
if (!evt.target.hasAttribute(DATA_ATTR) || !document.querySelector(SELECTOR) || !document.querySelector(`.${TOOLTIP_CLASS}`) || !evt.target.dataset.jsTooltip) return;

window.requestAnimationFrame(function() {
document.body.removeChild(document.querySelector(`.${TOOLTIP_CLASS}`));
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20489,4 +20489,4 @@ zwitch@^1.0.0:
zxcvbn@^4.4.2:
version "4.4.2"
resolved "https://registry.npmjs.org/zxcvbn/-/zxcvbn-4.4.2.tgz"
integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==
integrity sha512-Bq0B+ixT/DMyG8kgX2xWcI5jUvCwqrMxSFam7m0lAf78nf04hv6lNCsyLYdyYTrCVMqNDY/206K7eExYCeSyUQ==
Loading