yaooqinn opened a new pull request, #54560:
URL: https://github.com/apache/spark/pull/54560

   ### What changes were proposed in this pull request?
   
   Replace eager tooltip initialization on `DOMContentLoaded` with a single 
delegated `mouseover` event listener that lazily creates `bootstrap.Tooltip` 
instances on first hover.
   
   Changes:
   - `initialize-tooltips.js`: Replace `DOMContentLoaded` + `querySelectorAll` 
eager init with a single delegated `mouseover` listener on `document`
   - `stagepage.js`: Remove 6 redundant `new bootstrap.Tooltip()` calls
   - `historypage.js`: Remove 1 redundant tooltip init after DataTable render
   - `executorspage.js`: Remove 2 redundant tooltip inits after DataTable render
   - `timeline-view.js`: Use `getOrCreateInstance` for `show()` calls so 
programmatic tooltip display works without prior initialization
   
   ### Why are the changes needed?
   
   After the Bootstrap 5 upgrade (SPARK-55753), tooltips are eagerly 
initialized on `DOMContentLoaded` via `initialize-tooltips.js`, plus scattered 
`new bootstrap.Tooltip()` re-initialization calls in 5+ JS files after dynamic 
content renders (DataTables, timeline, etc.). This is fragile and error-prone — 
dynamically rendered elements (e.g., vis.js timeline items) are not present at 
`DOMContentLoaded`, so their tooltips silently fail.
   
   The delegated listener approach:
   - **Single source of truth** — no per-page boilerplate or re-init calls
   - **Handles dynamic content automatically** — DataTables, DAG viz, timeline 
items all work without explicit re-initialization
   - **Better performance** — only creates Tooltip for elements actually hovered
   - **Simpler code** — removed 9 scattered tooltip init calls
   - **Fixes timeline tooltips** — `getOrCreateInstance` ensures tooltips work 
on vis.js items that were not present at page load
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Tooltips behave identically — they appear on hover with the same content 
and positioning.
   
   ### How was this patch tested?
   
   - ESLint passes
   - 77 Scala UI tests pass (`core/testOnly org.apache.spark.ui.*`)
   - Manual verification via `spark-shell`: all pages (Jobs, Stages, Storage, 
Executors, SQL) serve correct BS5 tooltip markup and `initialize-tooltips.js` 
contains the lazy listener
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Yes, GitHub Copilot was used.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to