Kent Yao created SPARK-55764:
--------------------------------

             Summary: Use delegated event listener for Bootstrap 5 Tooltip lazy 
initialization
                 Key: SPARK-55764
                 URL: https://issues.apache.org/jira/browse/SPARK-55764
             Project: Spark
          Issue Type: Sub-task
          Components: Web UI
    Affects Versions: 4.2.0
            Reporter: Kent Yao


Currently, Bootstrap 5 tooltips are eagerly initialized on DOMContentLoaded via 
initialize-tooltips.js, plus scattered re-initialization calls in 5+ JS files 
(spark-dag-viz.js, timeline-view.js, etc.) after dynamic content renders.

Proposed improvement: Replace eager tooltip initialization with a single 
delegated mouseover event listener that lazily creates Tooltip instances on 
first hover.

Benefits:
- Single source of truth — no per-page boilerplate or re-init calls
- Handles dynamically rendered content automatically (DAG viz, timeline, tables)
- Better performance — only creates Tooltip for elements actually hovered
- Simpler code — remove scattered new bootstrap.Tooltip() calls

Implementation approach:
{code:javascript}
document.addEventListener('mouseover', function(e) {
  var el = e.target.closest('[data-bs-toggle="tooltip"]');
    new bootstrap.Tooltip(el);
    el.dispatchEvent(new MouseEvent('mouseover'));
  }
}, { passive: true });
{code}

Part of SPARK-55760 (Spark Web UI Modernization)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to