Contact form file upload missing ajax throbber

Created on 18 May 2016, about 8 years ago
Updated 11 September 2023, 10 months ago

When using Drupal Core to make a contact form with a file upload field the resulting UI does not let user know a file is being uploaded.

Once a file is provided the ajax upload begins immediately and is usually noticeable with the default Bartik 8.1.1 theme because it shows an ajax throbber. In the case of the Bootstrap theme the throbber is included in an upload button but that button is hidden thus no feedback to the user is given that their file is being uploaded.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Soundvessel

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 Kingdom 2dareis2do

    Not sure if this is the same but after working on bootstrap barrio I realised that I was missing the ajax spinner. Looking at other themes such as claro, it seems they require some js and css for this to work:

    For bootstrap it seems to be missing the following in theme.js

        /**
        * Theme override of the ajax progress indicator for full screen.
        *
        * @return {string}
        *   The HTML markup for the throbber.
        */
        ajaxProgressIndicatorFullscreen: function () {
          '<div class="ajax-progress ajax-progress-fullscreen spinner-border glyphicon glyphicon-refresh glyphicon-spin" role="status"><span class="visually-hidden">Loading...</span></div>';
        },

    Alternatively the same can be implemented in your sub theme using attach: function (context, settings) { e.g.

          /**
          * Theme override of the ajax progress indicator for full screen.
          *
          * @return {string}
          *   The HTML markup for the throbber.
          */
          Drupal.theme.ajaxProgressIndicatorFullscreen = () =>
            '<div class="ajax-progress ajax-progress-fullscreen spinner-border glyphicon glyphicon-refresh glyphicon-spin" role="status"><span class="visually-hidden">Loading...</span></div>';
    

    then in your theme you will need some css. e.g.:

    /* Full screen throbber */
    .ajax-progress-fullscreen {
      --bs-glyphicon-spin-font-size: 2rem;
      --bs-glyphicon-spin-color: @gray-darker;
      position: fixed;
      z-index: 1261;
      top: 50vh;
      left: 50vw;
      font-size: 2rem;
      margin-top: calc(--bs-glyphicon-spin-font-size/-2);
      margin-left: calc(--bs-glyphicon-spin-font-size/-2);
    }

    This is a modified version of whats in web/core/modules/system/css/components/ajax-progress.module.css

Production build 0.69.0 2024