Skip to content

fix(theme/bootstrap): submit search when a home suggestion is clicked#3152

Merged
marevol merged 1 commit into
masterfrom
fix/home-suggest-submit-on-click
Jun 17, 2026
Merged

fix(theme/bootstrap): submit search when a home suggestion is clicked#3152
marevol merged 1 commit into
masterfrom
fix/home-suggest-submit-on-click

Conversation

@marevol

@marevol marevol commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

In the bundled Bootstrap HTML theme, clicking a search suggestion on the home (top) page only filled the input without running the search — the user had to press the search button afterwards. Every other suggest path already submits:

  • the default JSP suggestor (js/suggestor.js),
  • the same theme's results-page header suggest (search.js mousedown handler), and
  • keyboard accept (Enter/Tab) on the results page.

This was an inconsistency, not intended behavior: the home wiring comment even states it should reach "parity with index.jsp" (which submits). The root cause is that the shared attachSuggest() helper in themes/bootstrap/assets/search.js filled the input but never submitted the form.

Why opt-in

attachSuggest() is also used by the advanced search form (advance.js, the "all words" input). There, auto-submitting when a single suggestion is clicked would be wrong because the other fields would still be empty. So submission is added as an opt-in submitOnSelect option that only the home page enables; advanced search stays fill-only.

Changes

  • themes/bootstrap/assets/search.jsattachSuggest() gains an opt-in submitOnSelect option. When set, after filling the input it dispatches a submit event on the input's form (input.form / closest("form")), mirroring the results-page header handler. Default behavior is unchanged (fill-only).
  • themes/bootstrap/assets/app.js — the home search box now passes submitOnSelect: true. The existing #home-search-form submit handler navigates to /search, so dispatching submit runs the search.
  • advance.js — unchanged (remains fill-only).
  • BundledBootstrapThemeTest — 3 new assertions: home enables the opt-in (app.js), the submit logic exists (search.js), and advanced search stays fill-only (advance.js).

Testing

mvn test -Dtest=BundledBootstrapThemeTest → 110 passed (2 new tests were red before the fix, green after).

Note: this repo has no JS unit-test framework, so verification uses the project's existing asset-content assertion style plus code review. A live browser run was not performed.

On the bundled Bootstrap HTML theme's home (top) page, clicking a search
suggestion only filled the input without running the search, while every
other suggest path submits (default JSP suggestor.js, the results-page
header suggest, and keyboard Enter/Tab). The shared attachSuggest() helper
filled the input but never submitted.

attachSuggest() is also used by the advanced search form, where
auto-submitting on a single field would be wrong (other fields empty), so
submission is opt-in via a new submitOnSelect option that only the home
wiring enables. The advanced search path stays fill-only.

Add BundledBootstrapThemeTest assertions covering the opt-in submit logic in
search.js, the home opt-in in app.js, and that advance.js stays fill-only.
@marevol marevol self-assigned this Jun 17, 2026
@marevol marevol added the task label Jun 17, 2026
@marevol marevol added this to the 15.7.0 milestone Jun 17, 2026
@marevol marevol merged commit 1648b7c into master Jun 17, 2026
1 check passed
@marevol marevol deleted the fix/home-suggest-submit-on-click branch June 18, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant