Problem/Motivation

The animated GIFs loading.gif and loading-small.gif icons look poor on HiDPI displays.

Note: some instances of .ajax-progress-throbber currently reference loading-small.gif, while others reference throbber-active.gif. throbber-active.gif is being worked on in a separate issue #1974928.

Proposed resolution

  • Replace the animated GIF file loading.gif with an animated scalable vector graphic (SVG) loading.svg that matches the look and feel.

  • Replace the animated GIF file loading-small.gif with an animated scalable vector graphic (SVG) loading-small.svg that matches the look and feel.

  • Update all references in Drupal core where loading-small.gif was previously used in the CSS background-image, including some instances of .ajax-progress-throbber and all instances of .ajax-progress-fullscreen. Since loading.gif is not referenced anywhere in Drupal core except in a single test, no CSS or IMG tag changes are required for this image.

  • Add an .htaccess RedirectRule to forward requests to the deleted GIF images to their respective SVG image equivalents.

Before / After comparison:

  1. loading.gif => loading.svg
    https://codepen.io/jameswilson/pen/OJYXqZE

  2. loading-small.gif => loading-small.svg
    https://codepen.io/jameswilson/pen/oNRLVxx

Remaining tasks

  1. Use the visual style / look of the existing loading GIF.
  2. Create an SVG based on ^ and animate it.
  3. Create an MR.
  4. Review and commit.

User interface changes

Users on devices with high resolution screens will see a modern, crisp image with no diffusion artifacts or blur inherent from legacy image formats.

Users on devices with low resolution may or may not notice any visual difference.

API changes

In as much as images can be considered an "API", the old GIF files will be removed. In case any themes still reference the old images, the routes to these static assets can be redirected at the server level to the new SVG assets. Such redirects have been added to the .htaccess file shipped with Drupal core.

Data model changes

None.

Release notes snippet

Not necessary.

Issue fork drupal-2575253

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

jwilson3 created an issue. See original summary.

Jmdrawneek@googlemail.com’s picture

Assigned: Unassigned » Jmdrawneek@googlemail.com

I'll create a few styles and see what you guys think.

Jmdrawneek@googlemail.com’s picture

Issue summary: View changes
StatusFileSize
new17.32 KB

Does anyone have any thoughts on these?

http://codepen.io/jmdrawneek/pen/ZbBpoK

Drupal spinners

jwilson3’s picture

Issue summary: View changes
jwilson3’s picture

I'm not sure about the change from white on black to blue on white.

I think it would be good to get a quick screenshot of how some of these are used on the page in context.

jwilson3’s picture

Issue summary: View changes
StatusFileSize
new14.45 KB
new11.08 KB
new11.06 KB

Of the demos you created, the best one is the first one. The radial effect is probably a winner, however there are too few "slices" of the different levels of transparency that make the radial gradient look blotchy. So, I made a first attempt at an improved codepen that uses a more "fluid" radial effect to avoid the jagged edges.

http://codepen.io/jameswilson/full/xwRXZy/

But while working on it, it became clear that this is not a realistic way to build the spinner because it depends on a second SVG with a radial gradient overlay that is then spun around, so when you change the background color behind the gradient to anything other than white, the effect looks extremely poor.

On white

On gray

For the more complex objects (like the druplicon or the star) we'll need to rewrite these using SVG masks. For the least complex radial one, I was able to refactor it to just a single rotating SVG, which resolves the issue of different background colors:

http://codepen.io/jameswilson/pen/BoQJVB

Jmdrawneek@googlemail.com’s picture

Yea I think the radial/gradient idea could work well. (Those were just sketches really hence lacking being polished)

What about wrapping the SVG in HTML with a background colour? That would make it more consistent and give it some adaptability to change the background/border at will.

I'll create some mockups of where it would be used this weekend.

mgifford’s picture

Those look great. I like the idea of using the drupal logo rather than just a circle.

snehi’s picture

StatusFileSize
new2.08 KB

I am ok with using the drupal logo rather then just a circle.
but the standard is this:

gif

xaiwant’s picture

StatusFileSize
new3.12 KB

How about this.

Spinner

mgifford’s picture

I'd go for #9, but that's just because it is a bit different. Both look good. How do we decide? Can it be done by 8.0.0?

Bojhan’s picture

Isn't there already an issue about this leveraging the style guide design (which we should follow, not invent our own here). ?

mgifford’s picture

I didn't find it https://groups.drupal.org/node/283223

Could it be somewhere else? Spinners are mentioned but not defined.

Jmdrawneek@googlemail.com’s picture

StatusFileSize
new109.29 KB
new95.94 KB
new103.6 KB
new89.1 KB

How about something like these?

These use a single svg that rotates, so gets around the issue above.

(Sorry about disappearing – relocating is time-consuming)

Just drop
Two drops
Single drop
Lots of drops
Only local images are allowed.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

emma.maria’s picture

Assigned: Jmdrawneek@googlemail.com » Unassigned
Status: Needs work » Closed (duplicate)

There is an older issue with an identical title, aim and agreed design in place over here... #1974928: Update Drupal's default throbber icons.

jwilson3’s picture

Status: Closed (duplicate) » Active

They are different icons, used in different places as far as I can tell. one is "throbber" the other one is "loading" and they are used for different purposes, which (i presume) is why they have different designs already in core. Agreed that the design is all over the place here. Why group two unrelated animated icons into one issue?

jwilson3’s picture

Could we scope this issue to leave the design of loading.gif alone and *just* convert the icon "as-is" to a CSS-animated SVG?

jwilson3’s picture

Here is a prototype using pure CSS animations:

http://codepen.io/jameswilson/pen/WwqyjK

emma.maria’s picture

Issue tags: +Needs design

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mradcliffe’s picture

Issue tags: +Dublin2016

Adding dublin2016 tag for general code sprints.

tameeshb’s picture

@jwilson3 May I work on this task or is it for a websprint ?

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.

jwilson3’s picture

@tameeshb, i think this is free to be worked on but be advised that other people are looking at this through the seven theme's design direction, so you might want to coordinate efforts with others that are involved there first before spinning wheels on design work as has been done in some of the previous comments on this thread.

Please see: #2775725: Update the throbber icon

tameeshb’s picture

Okay @jwilson3 I'll head over to #2775725

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

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Version: 8.4.x-dev » 8.5.x-dev
Related issues: +#2841433: Replace throbber gif in quickedit with SVG for retina
rachanakamlesh’s picture

Assigned: Unassigned » rachanakamlesh
rachanakamlesh’s picture

Assigned: rachanakamlesh » Unassigned
Status: Active » Needs review
StatusFileSize
new2.63 KB

As suggested in issue title that has to use SVG, So here I am attaching patch file containing loader images in SVG format.

dillix’s picture

For me #30 looks good.

snehi’s picture

Status: Needs review » Reviewed & tested by the community

looks good to me RTBC too.

Version: 8.5.x-dev » 8.6.x-dev

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

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 30: DrupalCore-loadingImage-2575253-30.patch, failed testing. View results

mohit1604’s picture

patch #30 applies cleanly on version 8.6.x , adding test for 8.6.x in #30 :)

cleverington’s picture

StatusFileSize
new5.3 KB

Patch #30 is passing tests, but see .png screenshot of the actually 'look' and 'feel' of the loader.

If the final deliverable was to make an as-is transition from loading.gif to loading.svg, it does not appear to pass.

Screenshot of potential loader for issue #2575253

dillix’s picture

Status: Needs work » Reviewed & tested by the community

RTBC for #30

cleverington’s picture

Status: Reviewed & tested by the community » Needs work

See #18 & #36. The _digital_ testing passes, but visual regression testing does not.

The current SVG does not appear to match _any_ of the styles used across different parts and systems of D8.

Porting 'as-is' and updating the look/feel should be separate issues and the SVG within the patch does not match the origin.

Either the final deliverable needs to be re-scoped or the task does not meet RTBC needs.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

BalajiDS’s picture

Issue summary: View changes
StatusFileSize
new44.6 KB

patch #30 works fine in Drupal -8.8.6, thanks @rachanakamlesh

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Gauravvvv made their first commit to this issue’s fork.

gauravvvv’s picture

Status: Needs work » Needs review

Balu Ertl made their first commit to this issue’s fork.

jwilson3’s picture

Status: Needs review » Needs work
Issue tags: -Usability, -styleguide, -Novice, -CSS novice, -Needs design +Needs issue summary update

I setup a codepen to review the before (GIF) and after (SVG) from the MR.

https://codepen.io/jameswilson/pen/wvbWNbr

Things are really close and this is exciting!

I found a few minor but important things to consider:

  1. The dots are slightly smaller in the SVG than in the GIF. The dots in the GIF are really too close to each other and to the edges of the image, making it look a little amaturish. This is really a good enhancement, IMO.
  2. The SVG duration is currently 1.0 seconds, but the GIF duration is 0.8 seconds (verified by uploading the current loading-small.gif to ezgif.com (here). One second appears slower and more lethargic, which is not what you want to portray when displaying a loader. There needs to be a slight sense of urgency that 0.8 seconds provides, versus 1 second.
  3. The GIF size is 24 x 24 pixels, the SVG is 25 x 25. I suggest we maintain the same dimensions by default if possible. Front end developers can always resize it with CSS in their theme and since it's a vector it will still look good!
  4. Issue needs summary update with final approach.
  5. Hide all the old patches, attachments, and approaches.
jwilson3’s picture

I've pushed fixes for the two items, and created a new codepen for comparison:

0.8s at 24px

https://codepen.io/jameswilson/pen/oNRLVxx

Compare against previous pen with 1s at 25px

https://codepen.io/jameswilson/pen/wvbWNbr

Solves #54.2 and #54.3

jwilson3’s picture

Issue summary: View changes

Restore issue summary lost by comment #43.

jwilson3’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

Clean up issue summary.

Solves #54.4

jwilson3’s picture

Hide file attachments from previous approaches in the issue summary.

Solves #54.5

jwilson3’s picture

Remaining tasks:

  • Needs replacement for loading.gif => loading.svg (with roughly the same SVG used for loading-small.svg, only with different dimensions.
  • Needs testing on simplytest.me with a before/after screenshots of loading.svg and loading-small.svg, to ensure no visual regressions.
jwilson3’s picture

I found an instance of loading-small.gif in the starterkit_theme that can be removed:

./core/themes/starterkit_theme/images/icons/loading-small.gif

Additionally, the starterkit_theme refers to its own copy of loading-small.svg, which doesnt exist, and therefore needs to be copied from core/misc/ folder into the theme's images/icons/ folder.

jwilson3’s picture

Status: Needs work » Needs review

I've fixed all relevant code points made in #54, #59, and #60. NR.

jwilson3’s picture

Issue summary: View changes

Since we're deleting the GIFs, we may want to consider adding an .htaccess rule to redirect the requests for the deleted GIF images to their respective SVG image counterparts. Thoughts?

jwilson3’s picture

Issue summary: View changes
jwilson3’s picture

Issue summary: View changes
jwilson3’s picture

Issue summary: View changes

I've created a comparison codepen for loading.gif => loading.svg

https://codepen.io/jameswilson/pen/OJYXqZE?

smustgrave’s picture

Status: Needs review » Needs work

May need a rebase. Reran the unit tests multiple time but fails each.

jwilson3’s picture

Rebased.

jwilson3’s picture

Status: Needs work » Needs review
jwilson3’s picture

There are all kinds of seemingly unrelated test failures after the rebase. It seems the 11.x branch may be a bit unstable at the moment.

Nevermind. I found one real failure worth fixing related to the htaccess file changes not being present in the scaffold file. Fix on the way.

jwilson3’s picture

Issue summary: View changes
jwilson3’s picture

Yay. tests pass now

smustgrave’s picture

Status: Needs review » Needs work

So brought this in #frontend and consensus seems to be these images could be used by third party modules so we can't delete. And there is no mechanism for deprecating images so can only remove in a major (D12)

So will need to add those images back and a CR in this ticket about the images being removed in 12

Opened #3452493: [12.x] Remove images that have been replaced in core for D12 to remove those images later.

jwilson3’s picture

Forgive my ignorance, but isn't D11 the next major? There isn't even a 12.x branch yet.

smustgrave’s picture

There's already a beta out for 11 so believe we have missed the boat. Why most deprecations are now going to D12.

Don't need to delete now just need to add the deleted images back, still using the new svgs, and add a CR. Gives contrib modules time to update if they are using.

Then when 12 opens we have that one ticket as a reminder to go and delete the images.

jwilson3’s picture

Status: Needs work » Needs review

I've restored core/misc/loading.gif and core/misc/loading-small.gif.

I did not restore the loading GIF in the starterkit theme, because by its very nature, it is not intended to be referenced, but instead forked/copied and manipulated. There's no need to ship starterkit with a file that will never be used.

And there is no mechanism for deprecating images so can only remove in a major (D12)

I get what you mean, and understand that the files can only be removed in a major upgrade, but I should clarify that the MR does include a mechanism for deprecating the old images which I think will work in the current D11 beta. Specifically:

  • Make an addition to .htaccess to redirect requests to the old files to the new files.
  • Ensure the new files are the exact same size and dimensions of the originals.
  • Write a CR to explain that the files are deprecated in D11.0 (assuming this gets in soon) and that themes and modules should check for references to these files and update them accordingly for D12 and optionally D11.
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

I can't speak on the .htaccess approach but thanks for adding those back!

I did create a super simple CR to announce that these images will be removed in 12.

nod_’s picture

Status: Reviewed & tested by the community » Needs work

Thanks for the workaound but let's drop the htaccess changes, since we're keeping the old images for now it won't be an issue. Removing in the next major is enough.

gauravvvv’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

The other one landed so imagine this solution works just fine as that.

  • nod_ committed 14669ce1 on 11.x
    Issue #2575253 by jwilson3, Gauravvvv, rachanakamlesh, Balu Ertl,...

nod_’s picture

Status: Reviewed & tested by the community » Fixed

Committed 14669ce and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jwilson3’s picture

For anyone following along here, I've opened another issue related to PNG to SVG conversion in core file icons: #3521857: Update Drupal's default file type icons to use SVG