Problem/Motivation

When a Views Data Export display uses automatic download and redirects back to a View with AJAX-enabled exposed filters, the exported file can download again when another AJAX action runs, such as Reset or Apply.

No new export request or batch is started. The previous automatic-download link is triggered again.

Steps to reproduce

  1. Create a View with exposed filters and Use AJAX enabled.
  2. Attach a Data Export display using Batch, Automatic download enabled, and redirect to the current display.
  3. Apply a filter and export the data. The file downloads once as expected.
  4. Click Reset or Apply on the exposed filters.
  5. The same exported file downloads again.

Root cause

After the export completes, VDE adds a status message containing:

<a id="vde-automatic-download" data-download-enabled="true" ...>here</a>

Drupal also passes the message through Drupal.announce(), which recreates the message markup inside #drupal-live-announce for screen-reader announcements.

This creates a second #vde-automatic-download element inside the live region.

VDE currently matches #vde-automatic-download anywhere in the document, so when Drupal.attachBehaviors() runs again after any AJAX request, that announcement copy is treated as a real download trigger and executes:

window.location.href = link.href;

This causes the previous export to download again.

The problem is not specific to Reset. Reset simply triggers another AJAX behavior pass; the actual defect is that VDE treats the screen-reader announcement copy as an actionable download link.

Proposed resolution

Ignore automatic-download links that are inside #drupal-live-announce.

The live region is only a screen-reader mirror of the status message and should not be treated as an actionable UI trigger.

For example:

if (link.closest('#drupal-live-announce')) {
  return;
}

This allows the real automatic-download link to work normally while preventing the announcement copy from triggering a second download during later AJAX behavior attachments.

Comments

ssawafta created an issue. See original summary.

ssawafta’s picture

Issue summary: View changes
ssawafta’s picture

Issue summary: View changes
ssawafta’s picture

Issue summary: View changes
ssawafta’s picture

ssawafta’s picture

Issue summary: View changes
ssawafta’s picture