Skip to content

fix: prevent autocomplete selection from submitting form#26646

Merged
timja merged 10 commits intojenkinsci:masterfrom
Wassef-Chebbi:master
Apr 20, 2026
Merged

fix: prevent autocomplete selection from submitting form#26646
timja merged 10 commits intojenkinsci:masterfrom
Wassef-Chebbi:master

Conversation

@Wassef-Chebbi
Copy link
Copy Markdown
Contributor

@Wassef-Chebbi Wassef-Chebbi commented Apr 16, 2026

Fixes #26639

Dropdown elements in the template lacked type="button", causing browsers to default them to type="submit" inside configuration forms. Clicking an autocomplete suggestion would therefore trigger an unintended form submission.
The fix sets type="button" at the template level in templates.js, covering all affected dropdowns globally — including the autocomplete and combo-box dropdowns mentioned in the issue.

Testing done

Manually tested in Firefox and Chrome by opening the Log Recorder configuration UI (/manage/log/), typing a partial value to trigger autocomplete, then selecting a suggestion via mouse click and Enter key. Verified the text field was populated and the form was not submitted. Also tested the "Build other projects" post-build action dropdown.

Screenshots (UI changes only)

Screenshot from 2026-04-16 10-40-32

Proposed changelog entries

  • Prevent selecting an autocomplete suggestion submitting the configuration form

Proposed changelog category

/label bug, web-ui

Proposed upgrade guidelines

N/A

Desired reviewers

@daniel-beck @timja

Copilot AI review requested due to automatic review settings April 16, 2026 09:53
@comment-ops-bot comment-ops-bot bot added regression-fix Pull request that fixes a regression in one of the previous Jenkins releases web-ui The PR includes WebUI changes which may need special expertise labels Apr 16, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a UI regression where selecting an autocomplete suggestion could submit the enclosing configuration form, by suppressing default submit-related event behavior during suggestion selection.

Changes:

  • Add preventDefault()/stopPropagation() to autocomplete suggestion click handling.
  • Treat Enter like Tab in the autocomplete item key handler.
  • Modify/remove several tracked IntelliJ .idea project files (icon/name/encodings).

Reviewed changes

Copilot reviewed 1 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/main/js/components/dropdowns/autocomplete.js Prevents autocomplete item interactions from triggering form submission.
.idea/encodings.xml Alters tracked IntelliJ encoding configuration (unrelated to the UI regression).
.idea/icon.svg Removes tracked IntelliJ project icon (unrelated to the UI regression).
.idea/.name Removes tracked IntelliJ project name (unrelated to the UI regression).
Files not reviewed (2)
  • .idea/.name: Language not supported
  • .idea/encodings.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/js/components/dropdowns/autocomplete.js Outdated
Comment thread src/main/js/components/dropdowns/autocomplete.js
Comment thread src/main/js/components/dropdowns/autocomplete.js Outdated
Comment thread .idea/encodings.xml Outdated
Copilot AI review requested due to automatic review settings April 16, 2026 10:14
@timja
Copy link
Copy Markdown
Member

timja commented Apr 16, 2026

Do we know that this is a regression? Nothing in @daniel-beck's issue suggests it is, we normally just categorise it as a bug if-so.

Comment thread .gitignore Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/js/components/dropdowns/templates.js
Comment thread src/main/js/components/dropdowns/templates.js
@comment-ops-bot comment-ops-bot bot added the bug For changelog: Minor bug. Will be listed after features label Apr 16, 2026
Copy link
Copy Markdown
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem to work at all. PR description doesn't map to whats been committed at all

Copilot AI review requested due to automatic review settings April 16, 2026 10:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 5 changed files in this pull request and generated 2 comments.

Files not reviewed (2)
  • .idea/.name: Language not supported
  • .idea/encodings.xml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/js/components/dropdowns/templates.js Outdated
Comment thread src/main/js/components/dropdowns/templates.js Outdated
@Wassef-Chebbi
Copy link
Copy Markdown
Contributor Author

Doesn't seem to work at all. PR description doesn't map to whats been committed at all

Sorry for the confusion, the description was outdated. The actual fix sets type="button" on all dropdown button elements in templates.js. I've updated the description to match what's been committed.

Comment thread .idea/.name
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you deleting these files

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that , I've restored the .idea files to their original state. The deletion was unintentional, caused by my local IntelliJ setup. They're back now and the PR only touches templates.js.

Copilot AI review requested due to automatic review settings April 16, 2026 11:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, manually tested log records and "Build other projects" in freestyle builds.

Thanks!

@timja timja requested a review from janfaracik April 16, 2026 13:16
@timja timja removed the regression-fix Pull request that fixes a regression in one of the previous Jenkins releases label Apr 16, 2026
@daniel-beck
Copy link
Copy Markdown
Member

Do we know that this is a regression? Nothing in @daniel-beck's issue suggests it is, we normally just categorise it as a bug if-so.

Other than the regression label? 😁

#26639 (comment)

@daniel-beck daniel-beck added the regression-fix Pull request that fixes a regression in one of the previous Jenkins releases label Apr 16, 2026
@timja
Copy link
Copy Markdown
Member

timja commented Apr 16, 2026

Do we know that this is a regression? Nothing in @daniel-beck's issue suggests it is, we normally just categorise it as a bug if-so.

Other than the regression label? 😁

#26639 (comment)

I've made the regression label red now so it stands out, missed that before.

Comment thread src/main/js/components/dropdowns/templates.js
Copy link
Copy Markdown
Member

@janfaracik janfaracik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment - otherwise LGTM, thanks!

Copilot AI review requested due to automatic review settings April 19, 2026 18:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@janfaracik
Copy link
Copy Markdown
Member

/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!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Apr 19, 2026
@timja timja merged commit 22bf0b9 into jenkinsci:master Apr 20, 2026
18 checks passed
@welcome
Copy link
Copy Markdown

welcome bot commented Apr 20, 2026

Congratulations on getting your very first Jenkins core pull request merged 🎉🥳

This is a fantastic achievement, and we're thrilled to have you as part of our community! Thank you for your valuable input, and we look forward to seeing more of your contributions in the future!

We would like to invite you to join the community chats and forums to meet other Jenkins contributors 😊
Don't forget to check out the participation page to learn more about how to contribute to Jenkins.


janfaracik added a commit to janfaracik/jenkins that referenced this pull request Apr 20, 2026
…6646)

Co-authored-by: Jan Faracik <43062514+janfaracik@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback regression-fix Pull request that fixes a regression in one of the previous Jenkins releases web-ui The PR includes WebUI changes which may need special expertise

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selecting an autocomplete suggestion submits the entire configuration form

5 participants