projectblacklight / blacklight

Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr) index.
http://projectblacklight.org/
Other
757 stars 256 forks source link

Advanced search start over button not clearing fields #3091

Closed bbpennel closed 4 months ago

bbpennel commented 9 months ago

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'%>
  3. 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.