I suggest adding an option to set the progress indicator on ajax links/buttons, targeted with classes .use-ajax and .use-ajax-submit like it is possible to set dialog-type and dialog-options:

element_settings.dialogType = $(this).data('dialog-type');
element_settings.dialog = $(this).data('dialog-options');

My suggestions is to keep the throbber default (seems obvious) and then add an option to override it with a data attribute named data-progress-type:

// Provide clicked links with a throbber as the default indicator,
// instead of the progress bar, since it looks better.
var progress_type = $(this).data('progress-type');
element_settings.progress = {type: progress_type ? progress_type : 'throbber'};

We're basically just providing the options to set the indicator to ex: fullscreen like we do in the Form API.
So I guess all the cases that made it relevant for #ajax in Form API also applies here. But let me know if you want some actual cases.

ajax-link-indicator.patch1.52 KBkallehauge


kallehauge created an issue. See original summary.

droplet’s picture

Issue tags: +Needs JS testing, +JavaScript

My first thoughts, I like it but we need to document what we're supporting there. We won't want to see any new issue about `progress bar` doesn't work in above code. :)

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.