Problem/Motivation

Follow-up to #2926105: Tabs fail to load when using Ajax (D8).

The committed fix improves the case where a View contextual filter uses a “Raw value from URL” style default argument, because that value can be resolved from the View request path.

There is still a related failure when the View contextual filter uses default_argument_type=node. Core’s node default argument plugin reads from current_route_match, not only from the View request path. During the Quick Tabs AJAX callback, the active route is still /quicktabs/ajax/..., not the original node route. As a result, the current node argument is unavailable and the unloaded tab renders empty.

Steps to reproduce

  1. Create two Views block displays.
  2. Add contextual filters that use the current node ID with default_argument_type=node.
  3. Configure one display to show the node title and the other to show the node body.
  4. Enable AJAX for a Quick Tabs instance, for example at /admin/structure/quicktabs/quicktabs_article/edit.
  5. Add two Views tabs, one for each display, and leave the Quick Tabs arguments field blank.
  6. Place the Quick Tabs block on all node pages.
  7. Remove the regular system content block during testing to avoid false positives.
  8. Visit a node page and click the second, initially unloaded tab.

Expected result: The second tab loads the View output for the current node.

Actual result: The second tab content is empty.

Proposed resolution

Restore enough original route context during the Quick Tabs AJAX callback for route-match based Views default arguments, such as default_argument_type=node, to resolve the source entity.

Alternatively, provide a documented and implemented way for Quick Tabs AJAX requests to pass the source entity argument explicitly when loading unloaded tabs.

Remaining tasks

  • Confirm the best approach for preserving or reconstructing the original route context during AJAX tab loading.
  • Add test coverage for Views tabs using default_argument_type=node.
  • Confirm the existing “Raw value from URL” case continues to work.

User interface changes

None expected.

API changes

None expected, unless the chosen fix adds a documented way to pass the source entity or route context into AJAX-loaded tabs.

Issue fork quicktabs-3605596

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Fixed

I committed the AJAX contextual filter fix for Quick Tabs Views content and Views blocks.

AJAX tab requests now carry the original page path through quicktabs_path, similar to core Views’ view_path, so contextual filters resolve against the source page instead of /quicktabs/ajax/....

This also removes the previous HTTP_REFERER dependency, preserves real page query parameters, and covers both Views tabs and Views block tabs.

Added test coverage for URL and node route contextual defaults, Views block tabs, and AJAX tab links carrying quicktabs_path.

I also manually confirmed the reported blank AJAX output is fixed for Views blocks with node contextual filters.

Big thanks to @ramil g for the clear local manual test scenario. That made this much easier to verify.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • joelpittet committed 4d2731bb on 4.0.x
    fix: #3605596 Quick Tabs AJAX does not load Views using current node...