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

Percy example combinations - patterns/search-and-filter #5177

Conversation

jmuzina
Copy link
Member

@jmuzina jmuzina commented Jun 19, 2024

Please review #5176 first as this depends on the vertical spacing introduced by #5176.

Search prompt script change

Introduces a change to the _search-prompt-script to make sure it is only called against search & filter components that actually have search prompt elements.

Why?

Without this check, the search & filter script is also called against search & filter components that aren't meant to have the search prompt script run against it, as more search & filter components are now in the DOM. This causes errors at the clear.addEventListener and prompt.addEventListener steps as those elements are not found.

What's the change?

Majority of the change is tabbing/formatting. The bit that is actually changed is here:

// Add click handler for clicks on elements with aria-controls
[].slice
  .call(document.querySelectorAll('.p-search-and-filter'))
  .filter(function (pattern) { // filter step was added to check if the component has a search prompt
    return pattern.querySelector('.p-search-and-filter__search-prompt');
  })
  .forEach(function (pattern) {
// setup search prompt controls....

QA

@webteam-app
Copy link

@jmuzina jmuzina force-pushed the examples-combinations-patterns-search-and-filter branch from 0d2011a to d50843c Compare June 20, 2024 19:45
@jmuzina jmuzina marked this pull request as ready for review June 20, 2024 19:47
@jmuzina jmuzina force-pushed the examples-combinations-patterns-search-and-filter branch from f2627e7 to 83cc31f Compare June 24, 2024 17:29
@bartaz bartaz merged commit 18489b4 into canonical:percy-examples-combination Jun 26, 2024
3 of 4 checks passed
jmuzina added a commit that referenced this pull request Jun 26, 2024
* spacing option in example template

* patterns/search-and-filter

* search and filter uses spacing option

* spacing option in example template

* fix search prompt functionality breaking comined examples (applying  search & filter functionality to search & filter components with no search prompt)

* replace search and filter spacing with rems

* rm combined.scss (superseded by rem spacing)

* update search & filter var naming per code review

* reorder search & filter combined examples
jmuzina added a commit that referenced this pull request Jun 27, 2024
* spacing option in example template

* patterns/search-and-filter

* search and filter uses spacing option

* spacing option in example template

* fix search prompt functionality breaking comined examples (applying  search & filter functionality to search & filter components with no search prompt)

* replace search and filter spacing with rems

* rm combined.scss (superseded by rem spacing)

* update search & filter var naming per code review

* reorder search & filter combined examples
@jmuzina jmuzina deleted the examples-combinations-patterns-search-and-filter branch August 28, 2024 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants