fix: prevent taxonomy directory tabs from being intercepted - #2975
Open
RabbiIslamRony wants to merge 2 commits into
Open
fix: prevent taxonomy directory tabs from being intercepted#2975RabbiIslamRony wants to merge 2 commits into
RabbiIslamRony wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
What kind of change does this PR introduce?
Description
How to reproduce the issue or how to test the changes
Main issue
When a page contains a Directorist Search Form together with All Categories or All Locations, the search-form script globally intercepts every
.directorist-type-nav__linkclick.Those taxonomy directory tabs are outside
.directorist-search-contents, but the handler callspreventDefault()before checking for a valid search-form parent. As a result, the active tab can change visually while the normal?directory_type=<slug>navigation is blocked and the displayed categories or locations remain unchanged.This change scopes the AJAX click handler to directory links inside
.directorist-search-contentsand verifies the parent before preventing navigation. All Categories and All Locations tabs can now follow their normal URL, while the Search Form directory switcher keeps its existing AJAX behavior.Easy test cases
[directorist_search_listing]and[directorist_all_categories]to the same page.?directory_type=<slug>and the categories update for that directory.[directorist_search_listing]and[directorist_all_locations]to the same page.atbdp_listing_types_formAJAX request still runs and the search fields update without a full-page navigation.Validation
npm run build-legacygit diff --checkAny linked issues
Fixes TeamSync #3255
Checklist