Views ajax reload is removing contextual links

Created on 9 March 2018, over 7 years ago
Updated 28 June 2025, about 7 hours ago

Problem/Motivation

When ajax and contextual links are enabled on a view, after triggering an ajax reload the contextual links block disappears.

Steps to reproduce:
- Go to the core Content view configuration
- Enable contextual filters
- Enable ajax
- Add enough content to show the pager (or set the pager amount low enough)
- Go to the content view
- See the contextual links
- Navigate to the next page
- Don't see the contextual link

Proposed resolution

Make sure the contextual link are added after a ajax reload.

Remaining tasks

- find the problem
- fix
- write tests

User interface changes

The contextual links don't disappear.

Original report

i have a view page of titles with a mini-pager. Views AJAX setting is on. On page load I the top rhs context menu is active on hover. when i page the view i lose it until page reload.

This is also breaking ajax_link_api module functionality in the same way. i.e. ajax breaks after first pager click.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component

views.module

Created by

πŸ‡¬πŸ‡§United Kingdom Syntapse

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    It looks like the .contextual element that contains the button and links gets removed on the ajax reload.

    I think this is because it's inside the element that is getting replaced.

    In the browser inspector, I moved the element outside of the .view element, and then ajax reloads don't remove them!

    A potential workaround is to just move them after the initial load, but that feels a little dirty.

    Are there any other examples of a component being refreshed with ajax that should have contextual links?

  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    There is some info in here that is potentially helpful: https://www.drupal.org/project/drupal/issues/2353419 πŸ“Œ Improve the way how views renders their contextual links Postponed: needs info

Production build 0.71.5 2024