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

Components: Standardize reduced motion handling using media queries #68421

Conversation

SainathPoojary
Copy link
Contributor

@SainathPoojary SainathPoojary commented Dec 31, 2024

Part of: #68282

What?

Refactors animation and transition styles to use @media not (prefers-reduced-motion) ensuring better accessibility for users who prefer reduced motion.

Why?

Currently, many parts of the codebase do not consider users’ motion preferences, which may not be suitable for those with reduced motion settings. This PR addresses and resolves that issue.

Screenshots or screencast

Button:

Transition:

2024-12-31.11-44-38.mp4

Animation

2024-12-31.11-55-39.mp4

checkbox-control:

Transition:

2024-12-31.12-34-35.mp4

circular-option-picker:

Transition:

2024-12-31.14-14-36.mp4

form-toggle:

Transition:

2024-12-31.14-42-02.mp4

form-token-field:

Transition:

2024-12-31.14-51-53.mp4

panel:

Transition:

2024-12-31.15-02-18.mp4

placeholder:

Transition:

2024-12-31.16-36-46.mp4

resizable-box:

Transition:

2025-01-02.13-28-56.mp4

Animation:

2025-01-02.13-48-27.mp4

tab-panel:

Transition:

2025-01-02.14-14-06.mp4

drop-zone:

Transition:

2025-01-02.14-29-09.mp4

animate

Animation:

2025-01-03.11-35-25.mp4

modal

Animation:

2025-01-03.13-06-51.mp4

toolbar

Animation:

2025-01-03.13-54-29.mp4

@SainathPoojary
Copy link
Contributor Author

SainathPoojary commented Dec 31, 2024

Hey @t-hamano,

This package includes several components. Would it be better to raise a new PR for the remaining components, or should I add them to this PR?

Components currently in PR:

button
checkbox-control
circular-option-picker
form-toggle
form-token-field
panel
placeholder

Remaining components:

resizable-box
tab-panel
animate
modal
toolbar
drop-zone

@t-hamano
Copy link
Contributor

t-hamano commented Jan 2, 2025

@SainathPoojary Thanks for working on this issue.

This package includes several components. Would it be better to raise a new PR for the remaining components, or should I add them to this PR?

It will be easy to test this PR because almost all components are published in Storybook, so I personally think it's okay to include all components in this PR.

@t-hamano t-hamano added [Type] Code Quality Issues or PRs that relate to code quality [Package] Components /packages/components labels Jan 2, 2025
@SainathPoojary
Copy link
Contributor Author

Got it, I agree! I’ll include the remaining components in this PR.

@SainathPoojary SainathPoojary marked this pull request as ready for review January 3, 2025 11:52
Copy link

github-actions bot commented Jan 3, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: SainathPoojary <sainathpoojary@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@SainathPoojary
Copy link
Contributor Author

Hey @t-hamano,

I have standardized the transition and animation for the Component package and attached a video demonstrating the tests for each component. Please take a look when you have a moment.

Thank you!

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I've tested all components on Storybook and everything appears to work as before.

In order for this PR to be shippable, could you confirm the following?

@WordPress/gutenberg-components If you have any feedback on this PR, please let us know 🙏


Note: The CI error reported in the comment (Storybook build error) does not occur in this PR.

Presumably the error only occurs when surrounded by a breakpoint mixin like below, but there are no media queries surrounded by a breakpoint mixin in this PR:

.selector {
	@include break-medium {
		@media not (prefers-reduced-motion) {
		}
	}
}

packages/components/src/circular-option-picker/style.scss Outdated Show resolved Hide resolved
packages/components/src/resizable-box/style.scss Outdated Show resolved Hide resolved
@SainathPoojary
Copy link
Contributor Author

Hey @t-hamano,

I have implemented all the requested changes and also updated the code with the trunk, Please have a look at your convenience.

Thank you!

Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

LGTM! All components appear to be correctly standardized.

Before shipping this PR, can you check the following points?

  • Move the changelog entry to the correct place. It needs to be in the Unreleased section:
    ## Unreleased
    
    ### Internal
    
    -   `Components`: Standardize reduced motion handling using media queries ([#68421](https://github.com/WordPress/gutenberg/pull/68421)).
    
    ## 29.1.0 (2025-01-02)
  • Rebase this PR so that All CIs pass

@SainathPoojary
Copy link
Contributor Author

Hey @t-hamano,

I have moved the changelog entry to the correct place now. Previously, I merged trunk into my PR, and I believe all the CI checks are now passing. Would you like me do it again?

Thank you!

@t-hamano t-hamano self-requested a review January 7, 2025 09:57
Copy link
Contributor

@t-hamano t-hamano left a comment

Choose a reason for hiding this comment

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

Unfortunately, after testing this PR again, it appears that Storybook is no longer able to build. This is the same issue reported here.

I don't know the exact reason yet, but it might be a good idea to merge the Storybook build's CI (#68466) first while we investigate the cause.

@t-hamano
Copy link
Contributor

t-hamano commented Jan 7, 2025

I was wrong. After running npm install on another old branch, I didn't run npm install after switching to this branch 😅

In this PR, The StoryBook build is indeed successful. Just to be sure, I tried rebasing this PR with the trunk branch, and it worked just as well.

@t-hamano t-hamano self-requested a review January 7, 2025 10:22
@t-hamano t-hamano merged commit 900862e into WordPress:trunk Jan 7, 2025
66 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.1 milestone Jan 7, 2025
westonruter added a commit that referenced this pull request Jan 7, 2025
…ry/interactivity-lazy-hydration

* 'trunk' of https://github.com/WordPress/gutenberg: (143 commits)
  Update: Bundle upload media. (#68522)
  Add: Media field changing ui to Dataviews and content preview field to posts and pages (#67278)
  Bump the react-native group with 2 updates (#68095)
  Check Storybook build on CI for PRs (#68466)
  Bump the github-actions group across 1 directory with 2 updates (#68436)
  Classic theme preview: remove admin-bar class name (#68519)
  Remove geriux as code owner (#68523)
  Post Featured Image: Adds control to clear the the overlay color (#68525)
  Components: Standardize reduced motion handling using media queries (#68421)
  Upgrade Playwright to v1.49 (#68504)
  Document Outline: Use block client ID as unique 'key' (#68502)
  Storybook: Add UnitControl story (#67346)
  Details: Add allowedBlocks and TemplateLock attributes (#68489)
  Post Comment Link: Show Border Control By Default (#68506)
  Query Total: Show Border Controls By Default (#68507)
  RSS: Added Colour support (#66419)
  Refactor: Separate input form styles to a dedicated stylesheet (#68501)
  Code quality: Fix typos (#67304)
  Page List: Added color support (#66430)
  Fix flaky DataViews list arraow nav e2e tests (#68503)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants