You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "yaooqinn (via GitHub)" <gi...@apache.org> on 2026/03/01 08:18:41 UTC
[PR] [SPARK-55764][UI] Use delegated event listener for Bootstrap 5 Tooltip lazy initialization [spark]
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55764][UI] Use delegated event listener for Bootstrap 5 Tooltip lazy initialization [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #54560:
URL: https://github.com/apache/spark/pull/54560#discussion_r2872873306
##########
core/src/main/resources/org/apache/spark/ui/static/timeline-view.js:
##########
@@ -94,7 +94,7 @@ function drawApplicationTimeline(groupArray, eventObjArray, startTime, offset) {
function() {
$(getSelectorForJobEntry(getIdForJobEntry(this))).addClass("corresponding-item-hover");
var el = $($(this).find("div.application-timeline-content")[0])[0];
- var tt = bootstrap.Tooltip.getInstance(el); if (tt) tt.show();
+ var tt = bootstrap.Tooltip.getOrCreateInstance(el); tt.show();
Review Comment:
Thank you @sarutak, updated
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55764][UI] Use delegated event listener for Bootstrap 5 Tooltip lazy initialization [spark]
Posted by "sarutak (via GitHub)" <gi...@apache.org>.
sarutak commented on code in PR #54560:
URL: https://github.com/apache/spark/pull/54560#discussion_r2872607000
##########
core/src/main/resources/org/apache/spark/ui/static/timeline-view.js:
##########
@@ -94,7 +94,7 @@ function drawApplicationTimeline(groupArray, eventObjArray, startTime, offset) {
function() {
$(getSelectorForJobEntry(getIdForJobEntry(this))).addClass("corresponding-item-hover");
var el = $($(this).find("div.application-timeline-content")[0])[0];
- var tt = bootstrap.Tooltip.getInstance(el); if (tt) tt.show();
+ var tt = bootstrap.Tooltip.getOrCreateInstance(el); tt.show();
Review Comment:
```suggestion
var tt = bootstrap.Tooltip.getOrCreateInstance(el, {container: "body"}); tt.show();
```
here and other similar places?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55764][UI] Use delegated event listener for Bootstrap 5 Tooltip lazy initialization [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn closed pull request #54560: [SPARK-55764][UI] Use delegated event listener for Bootstrap 5 Tooltip lazy initialization
URL: https://github.com/apache/spark/pull/54560
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55764][UI] Use delegated event listener for Bootstrap 5 Tooltip lazy initialization [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #54560:
URL: https://github.com/apache/spark/pull/54560#issuecomment-3979493967
<img width="2432" height="1328" alt="image" src="https://github.com/user-attachments/assets/0fd791e8-eea6-4c2d-a91b-16aaedd4ea06" />
<img width="2386" height="1332" alt="image" src="https://github.com/user-attachments/assets/7383d50e-3363-4d08-8b34-678d8be15e6c" />
<img width="2412" height="1280" alt="image" src="https://github.com/user-attachments/assets/b52a2053-a78d-4940-be3b-c6e1c5cadf6f" />
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55764][UI] Use delegated event listener for Bootstrap 5 Tooltip lazy initialization [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #54560:
URL: https://github.com/apache/spark/pull/54560#issuecomment-3985156354
Merged to master, thank you @sarutak @peter-toth
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-55764][UI] Use delegated event listener for Bootstrap 5 Tooltip lazy initialization [spark]
Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #54560:
URL: https://github.com/apache/spark/pull/54560#issuecomment-3985929208
Thank you @dongjoon-hyun
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org