woocommerce/plugins/woocommerce-blocks/assets/js/blocks/product-collection/style.scss

47 lines
1.0 KiB
SCSS
Raw Normal View History

Product Collection: Add loading indicator for client-side pagination (#44571) * Add animation for client-side pagination This includes: - Addition of animation state management in the frontend file to control the visual transition between pagination states. - Introduction of new SCSS rules for the start and finish animations, ensuring a seamless and visually appealing pagination experience. - Modification of the PHP logic to inject necessary HTML for the animation to be applied. These updates aim to provide a more engaging and responsive interface for users navigating through product collection. * Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce * Allow user clicks under product collection's loading animation This commit enhances the user experience of the loading animation for the product collection block. Changes include: - Specifying `transform-origin: 0% 0%;` directly within the block's initial style to indicate the animation should start from the left - Adding `pointer-events: none;` to allow user interactions with elements underneath the loading animation, thus improving usability by not blocking clicks. Additionally, redundant `transform-origin` properties were removed from the `@keyframes` declaration to clean up the code and avoid unnecessary repetition. This simplification contributes to both the maintainability and readability of the stylesheet. * Fix linting errors in SCSS file --------- Co-authored-by: github-actions <github-actions@github.com>
2024-02-16 10:13:58 +00:00
// This animation will be shown when user change the pages in the product collection block
.wc-block-product-collection__pagination-animation {
position: fixed;
top: 0;
left: 0;
margin: 0;
padding: 0;
width: 100vw;
max-width: 100vw;
height: 4px;
background-color: var(--wp--preset--color--primary, #000);
opacity: 0; // Hide the animation by default.
transform-origin: 0% 0%; // Start the animation from the left.
pointer-events: none; // Allows click events to pass through to elements underneath.
&.start-animation {
animation: wc-block-product-collection__pagination-start-animation 30s cubic-bezier(0.03, 0.5, 0, 1) forwards;
}
&.finish-animation {
Improve Accessibility in Product Collection Navigation (#44599) * Add animation for client-side pagination This includes: - Addition of animation state management in the frontend file to control the visual transition between pagination states. - Introduction of new SCSS rules for the start and finish animations, ensuring a seamless and visually appealing pagination experience. - Modification of the PHP logic to inject necessary HTML for the animation to be applied. These updates aim to provide a more engaging and responsive interface for users navigating through product collection. * Enhance accessibility for product collection navigation This commit introduces several improvements to enhance accessibility and user experience. Specifically, it adds new context properties to manage accessibility messages during the navigation process, including messages for loading and when a page has loaded. These changes ensure that screen reader users receive appropriate feedback during navigation. Changes made: - Added `accessibilityMessage`, `accessibilityLoadingMessage`, and `accessibilityLoadedMessage` properties to the `ProductCollectionStoreContext`. These properties store messages to be announced by screen readers during different stages of page navigation. - Implemented logic in the product collection store to update the `accessibilityMessage` during the start of navigation (showing a loading message) and upon completion (showing a loaded message). - Utilized a technique to ensure that consecutive identical messages are still announced by screen readers, by appending a no-break space to the message if it is the same as the previous one. This follows a pattern similar to the `@wordpress/a11y` package. - In `ProductCollection.php`, enhanced the block's HTML output to include these new accessibility messages and integrated them with the existing interactive data attributes. This ensures that the front-end components are fully prepared to handle these accessibility enhancements. - Added a new `div` with `class="screen-reader-text"` and `aria-live="polite"` attributes, which dynamically displays the accessibility message based on the navigation state. This div complements the visual pagination animation with an accessibility-focused mechanism for announcing the page load states to screen reader users. By addressing accessibility considerations with these enhancements, we're making Product Collection navigation more inclusive and user-friendly for all users. * Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce --------- Co-authored-by: github-actions <github-actions@github.com>
2024-02-19 06:05:14 +00:00
animation: wc-block-product-collection__pagination-finish-animation 300ms ease-in;
Product Collection: Add loading indicator for client-side pagination (#44571) * Add animation for client-side pagination This includes: - Addition of animation state management in the frontend file to control the visual transition between pagination states. - Introduction of new SCSS rules for the start and finish animations, ensuring a seamless and visually appealing pagination experience. - Modification of the PHP logic to inject necessary HTML for the animation to be applied. These updates aim to provide a more engaging and responsive interface for users navigating through product collection. * Add changefile(s) from automation for the following project(s): woocommerce-blocks, woocommerce * Allow user clicks under product collection's loading animation This commit enhances the user experience of the loading animation for the product collection block. Changes include: - Specifying `transform-origin: 0% 0%;` directly within the block's initial style to indicate the animation should start from the left - Adding `pointer-events: none;` to allow user interactions with elements underneath the loading animation, thus improving usability by not blocking clicks. Additionally, redundant `transform-origin` properties were removed from the `@keyframes` declaration to clean up the code and avoid unnecessary repetition. This simplification contributes to both the maintainability and readability of the stylesheet. * Fix linting errors in SCSS file --------- Co-authored-by: github-actions <github-actions@github.com>
2024-02-16 10:13:58 +00:00
}
}
@keyframes wc-block-product-collection__pagination-start-animation {
0% {
transform: scaleX(0);
opacity: 1;
}
100% {
transform: scaleX(1);
opacity: 1;
}
}
@keyframes wc-block-product-collection__pagination-finish-animation {
0% {
opacity: 1;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}