blacklight icon indicating copy to clipboard operation
blacklight copied to clipboard

Advanced search start over button not clearing fields

Open bbpennel opened this issue 2 years ago • 0 comments

When testing with blacklight 7.33.1, we are finding that the "Start over" button on the advanced search page does not clear inputs in the following case:

  1. Go to the advanced search page and input search terms, submit the search.
  2. Click on the link to return to the advanced search page. In our repository the link is generated as follows:
<%= link_to 'Advanced search', blacklight_advanced_search_engine.advanced_search_path(search_state.to_h), class: 'advanced_search'%>
  1. On the advanced search page, the inputs will be prepopulated. Click the "Start over" button and nothing happens.

It looks like before the feature was moved from the advanced search plugin to black that the start over button was a link: https://github.com/projectblacklight/blacklight_advanced_search/blob/v6.4.1/app/views/advanced/_advanced_search_submit_btns.html.erb#L9 but in blacklight 7-8 it is a reset button: https://github.com/projectblacklight/blacklight/blob/v8.0.1/app/components/blacklight/advanced_search_form_component.html.erb#L53 My guess is the issue is that the fields are prepopulated, and reset buttons only reset fields back to their starting value, so nothing happens.

Switching back to a link would probably be the simplest solution, since having the form prepopulated with the users previous terms is desirable.

bbpennel avatar Oct 11 '23 20:10 bbpennel