[JENKINS-76118] Fix toggle collapse race condition in Chrome#11115
Conversation
This change modifies toggle links to use data-post-href initially instead of href. JavaScript now sets the href only when the POST handler is attached, which prevents 404 errors caused by clicking buttons before scripts are fully loaded. It also resolves a Chrome-specific issue where progressive rendering made buttons clickable too early. In addition, comprehensive test documentation and an automated browser test script have been added to verify the fix and provide reproduction steps. Files updated include enhancements to link.js for data-post-href, updates to pane.jelly and executors.jelly to use the new attribute.
db2fe0e to
d6b7186
Compare
|
Hi @MinuteHanD! The initial issue is tricky to reproduce as Chrome DevTools throttling does not allow to support single request. I tested the changes and collapse/expand is working as expected. I didn't find other reference of LGTM. Thanks from the contribution! |
timja
left a comment
There was a problem hiding this comment.
seems fine as a small change, probably better to not have this hacky link form in the first place and just use a button.
Thanks!
/label ready-for-merge
This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.
Thanks!
|
Congratulations on getting your very first Jenkins core pull request merged 🎉🥳 |
This change modifies toggle links to use data-post-href initially instead of href. JavaScript now sets the href only when the POST handler is attached, which prevents 404 errors caused by clicking buttons before scripts are fully loaded. It also resolves a Chrome-specific issue where progressive rendering made buttons clickable too early.
In Chrome, toggle collapse buttons (e.g., "Build Executor Status") can trigger 404 errors when clicked immediately
after page load. This happens because Chrome makes the buttons clickable before JavaScript finishes loading, causing GET requests instead of the required POST requests.
fix: Initially rendering links with data-post-href instead of href, making them non-clickable until JavaScript loads and moves the URL to href while attaching the POST handler. This ensures buttons only become clickable when properly configured for POST requests.
Eliminates 404 errors
See JENKINS-76118.
Testing done
Proposed changelog entries
Proposed changelog category
/label
Proposed upgrade guidelines
N/A
Submitter checklist
@Restrictedor have@since TODOJavadocs, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO"), if applicable.evalto ease future introduction of Content Security Policy (CSP) directives (see documentation).Desired reviewers
@mention
Before the changes are marked as
ready-for-merge:Maintainer checklist
upgrade-guide-neededlabel is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidateto be considered (see query).