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

Fix searchform collapse behaviour #411

Merged
merged 1 commit into from
Mar 1, 2023
Merged

Conversation

crftwrk
Copy link
Member

@crftwrk crftwrk commented Mar 1, 2023

This PR improves/fixes the searchform collapse behaviour.

Before

https://bootscore.me

  • Click on search toggler opens collapse and focusses the searchform
  • If searchform loses focos, collapse hide

This works fine if bootScore/Woo searchorm or a a completely different widget is used in this position. In #312, a third party searchform is used. The result: On toggler click, searchform collapse opens but form gets not focussed. Because there is no focus, collapse close by itself.

After

Closing collapse is now decoupled from searchform focus. Snippet checks if a click is outside #collapse-searchand closes collapse then.

  • Click on search toggler opens collapse and focusses the searchform
  • If click is outside #collapse-search, collapse hide

Test

https://dev.bootscore.me/

  • Click search-toggler in the navbar
  • Click inside #collapse-search just 1px left or right next to the search´form - searchform stays open
  • Click somewhere outside - collapse hides

Closes #312

@crftwrk crftwrk requested a review from justinkruit March 1, 2023 10:27
@justinkruit
Copy link
Member

I know having a click check on every body click could get heavy for a browser, but I don't notice a performance hit on this, so this should alright.

@crftwrk
Copy link
Member Author

crftwrk commented Mar 1, 2023

Want to merge quickly? I‘m not in front of my machine right now.

@justinkruit justinkruit merged commit ddb7aee into main Mar 1, 2023
@crftwrk crftwrk deleted the Fix-search-collapse-behaviour branch April 11, 2023 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Search doesn't stay open on mobile after clicking icon
2 participants