fix(ui): re-enable Add button when hetero-list item is deleted#26937
Open
amarkdotdev wants to merge 1 commit into
Open
fix(ui): re-enable Add button when hetero-list item is deleted#26937amarkdotdev wants to merge 1 commit into
amarkdotdev wants to merge 1 commit into
Conversation
Member
|
Please restore the default pull request template for submitting pull requests |
Member
Author
|
/label regression-fix |
When an item is deleted from a one-each hetero-list, the Add button stays disabled until manually clicked. This regression was introduced in jenkinsci#10186. Root cause: toggleButtonState counts elements with class repeated-chunk, but deleted elements get the fade-out class and are only removed from the DOM after the CSS transition ends. The MutationObserver fires on childList changes (actual removal), which happens too late — by the time the animation ends the user has already seen a disabled button they cannot use. Fix: - Exclude elements with the fade-out class from the selected count in toggleButtonState, since they are visually and logically deleted. - Observe attribute changes (class) in addition to childList, so toggleButtonState runs immediately when fade-out is applied rather than waiting for the element to be physically removed. Fixes jenkinsci#26737 Signed-off-by: Aaron <aaroniofjm@gmail.com>
e80cdc8 to
a904392
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #26737
When all items are added to a one-each hetero-list (e.g. post-build actions in a Freestyle job), the Add button correctly disables. But when an item is removed, the button stays disabled until clicked. Regression from #10186.
Root cause:
toggleButtonState()counts.repeated-chunkelements to determine if the list is full. Deleted elements get thefade-outclass and are only DOM-removed after the CSS transition ends. TheMutationObserver(watchingchildList) fires too late.Fix:
.fade-outelements from the count — they are logically deleted.attributes(class changes) in addition tochildList, so the button re-enables immediately whenfade-outis applied.Testing done
Reproduced the bug on Jenkins 2.536+ by adding all post-build actions in a Freestyle job until the Add button disabled, then deleting one. Before the fix, button stays disabled. After the fix, button re-enables immediately on deletion.
Screenshots (UI changes only)
Not included — the visual behavior is that the Add button transitions from disabled to enabled state when a list item is deleted, matching the pre-2.536 behavior.