Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is-busy animation to save changes button in settings #47626

Merged
merged 7 commits into from
May 22, 2024

Conversation

ilyasfoo
Copy link
Contributor

Changes proposed in this Pull Request:

Closes #47305

This PR attempts to add loading animations to Settings screen by hitchhiking CSS classes provided by Gutenberg components. This is meant to be an acceptable temporary UX improvment while we work on settings UI refresh.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Go to WooCommerce > Settings > General
  2. Click on Save changes
  3. Go to WooCommerce > Settings > Site visibility
  4. Click on any toggle to enable save button
  5. Click on Save changes
  6. Observe busy loading animations
  7. Go to WooCommerce > Settings > Shipping
  8. Click on Add zone
  9. Observe Save changes and Add shipping method button is slightly larger
  10. Enter a zone name
  11. Save to see the busy animation, but most likely it's too quick to be observed
  12. Test other settings screens and ensure nothing around saving is broken
5xX4Vu.mp4

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@ilyasfoo ilyasfoo requested review from a team, adrianduffell and rjchow May 20, 2024 14:44
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label May 20, 2024
Copy link
Contributor

Hi @adrianduffell, @rjchow, @woocommerce/ghidorah

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

github-actions bot commented May 20, 2024

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

Copy link
Member

@chihsuan chihsuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Observe Save changes and Add shipping method button is slightly larger
  2. Enter a zone name
  3. Save to see the busy animation, but most likely it's too quick to be observed

I used network throttling to slow down the request but I was able to see the busy animation on the shipping zone save.

Screen.Recording.2024-05-21.at.10.55.29.mov

It seems that the is-busy class is added after the request is completed. However, there is another spinner that is shown when the request is in progress. If can find a way to make the spinner show before the request is completed that would be great but I think this is fine for now.

I also tested the other settings screens and everything seems to be working fine. 👍

@ilyasfoo
Copy link
Contributor Author

It seems that the is-busy class is added after the request is completed. However, there is another spinner that is shown when the request is in progress. If can find a way to make the spinner show before the request is completed that would be great but I think this is fine for now.

Thanks for spotting that, @chihsuan! Great suggestion to use throttling to test. I've fixed the busy state in 4e580dd so it triggers on submit instead.

Copy link
Contributor

@adrianduffell adrianduffell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, @ilyasfoo! LGTM -- I tested every settings screen without issue 👍 👍

However the animation didn't appear in Safari. It looks like this is due to the disabled attribute for some reason. I also confirmed the post editor only sets aria-disabled during the loading state. Perhaps we should do the same? 🤔

@ilyasfoo
Copy link
Contributor Author

@adrianduffell Thanks! However, I was unable to reproduce the issue with disabled attribute (the buttons in settings page are not disabled on saving). It does seem like the screen is frozen while the request is loading, thus the animation is not visible before the screen goes off. You can confirm this by adding e.preventDefault(); below this line which will stop the page from going away to observe is-busy class set.

I found another bug where the animation is super janky and is resolved by disabling and reenabling style, but I believe it's a Safari specific bug:

4lDQRq.mp4

However, I wasn't able to find a quick fix and I wouldn't want to spend too much time on debugging it 😅

This reverts commit 3ac7242.
@adrianduffell
Copy link
Contributor

It does seem like the screen is frozen while the request is loading, thus the animation is not visible before the screen goes off.

Thanks @ilyasfoo, I think this is what I'm seeing. Perhaps we can improve it in a follow-up but I'm happy to merge.

@ilyasfoo ilyasfoo merged commit 7794a7a into trunk May 22, 2024
24 checks passed
@ilyasfoo ilyasfoo deleted the tweak/save-button-loading-animation branch May 22, 2024 06:50
@github-actions github-actions bot added this to the 9.0.0 milestone May 22, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label May 22, 2024
@Stojdza Stojdza added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels May 22, 2024
@kallehauge kallehauge mentioned this pull request Jun 10, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add loading state to save button
4 participants