Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible for the site search input field to have different values for "name" and ID #688

Merged
merged 1 commit into from
Jun 3, 2020

Conversation

yvonnetangsu
Copy link
Member

@yvonnetangsu yvonnetangsu commented May 28, 2020

READY FOR REVIEW

Summary

  • Currently, in the site search component search input field, the "name" attribute and ID are forced to take on the same value (variable search_input_name), but on some sites when there are multiple instances of the search form, sometimes we need 2 forms with the same "name" for the input fields but different IDs.
  • This PR adds the option to add a different ID search_input_id when needed. If that's not provided, it will be the same as the value for "name"
  • Note: There might be a different approach to this - do we need the search input field to have an ID at all? If not, perhaps we can remove it and just add an additional_input_attribute variable in the next Decanter version.

Needed By (Date)

  • Sooner the better

Urgency

  • N/A

Steps to Test

  1. Copy the content of site-search.twig and paste the content into a test.twig (needs to create this file) file in the developer folder and follow the README there to set up the preview environment.
  2. Add test.json file in the developer directory with different search_input_name and search_input_id values.
  3. Do npm run dev and npm run start. Look at the site search component on the rendered page in the inspector and verify that the ID and name for the search input field are different.

Affected Projects or Products

  • Decanter
  • D8
  • Redwood

Associated Issues and/or People

@@ -1,6 +1,6 @@
{
"name": "decanter",
"version": "6.0.6-dev",
"version": "6.0.7-dev",
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this.

Comment on lines +25 to +27
{%- if search_input_id is empty -%}
{%- set search_input_id = search_input_name -%}
{%- endif -%}
Copy link
Member

Choose a reason for hiding this comment

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

This keeps it backwards compatible but we should remove it in version 7 and just go with the two separate ids.

@sherakama sherakama merged commit dbbef0b into master Jun 3, 2020
@sherakama sherakama deleted the 686-site-search-id branch June 3, 2020 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants