Commit Graph

5 Commits

Author SHA1 Message Date
Albert Juhé Lluveras e042beaff3 Move Mini Cart block component into its own file (https://github.com/woocommerce/woocommerce-blocks/pull/4737) 2021-09-15 13:40:36 +02:00
Albert Juhé Lluveras 95ab1f3fc4 Improve accessibility when removing items from cart (https://github.com/woocommerce/woocommerce-blocks/pull/4673)
* Add custom close button label to Mini Cart drawer

* Add screen reader notice when removing an item from cart

* Focus next item from cart when an item is removed

* Add back CSS to hide close button label

* Don't focus previous item after the last one is removed

* Remove period from button label

* Don't show the number of items in Cart if Mini Cart is loading

This prevents displaying outdated data. That's specially important
for screen readers, because they were reading the outdated value
before it was replaced by the new one.

* Focus cart items table when last item in list is removed

* Use a ref to focus cart items table

* Use a ref to focus cart item table rows

* Fix empty cart if Mini Cart items have been removed

* Update snapshots
2021-09-14 08:09:45 +02:00
Albert Juhé Lluveras decfe6c501 Open Mini Cart block when adding a product to cart via an AJAX call (https://github.com/woocommerce/woocommerce-blocks/pull/4666) 2021-09-07 10:27:16 +02:00
Albert Juhé Lluveras f3ec10a89c Add Drawer component (https://github.com/woocommerce/woocommerce-blocks/pull/4608)
* Add Drawer component

* Use element dataset instead of a window global

* Rename miniCartOverlay to miniCartDrawerPlaceholder

* Refactor styles so screen overlay covers the entire screen

* Use rem instead of em for the drawer title size to keep it consistent between renders

* Keep focus when replacing the mini cart button

* Match overlay colors from designs

* Use is-loading class like several other blocks

* Add more doc comments

* Don't listen to clicks on Mini Cart button when it's open

* Update Drawer component styles
2021-09-02 11:44:25 +02:00
Albert Juhé Lluveras 2b2631d7ab Add Mini Cart block in experimental builds (https://github.com/woocommerce/woocommerce-blocks/pull/4510)
* Create MiniCart block prototype

* Use window.onload instead of DOMContentLoaded

* Don't load translations for scripts without localized strings

* Don't try to load cart instance in API requests

* Remove PHP pre-rendering

* Fix some typos

* Move Mini Cart block files under 'cart-checkout' directory

* Update selectors to follow guidelines

* Only enable the MiniCart block in experimental builds

* Fix wrong translations element selector

* Improve lazyLoadScript and preloadScript documentation

* Move lazy-load-script and preload-script to base-utils

* Add function to check if script tag is already in the DOM
2021-08-25 17:42:55 +02:00