Skip to content

Commit

Permalink
Merge branch 'develop' into AC-2498
Browse files Browse the repository at this point in the history
  • Loading branch information
dpatil-magento authored Nov 16, 2022
2 parents ed67bfd + 60c3e8e commit 8531cb4
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ Here, you can learn PWA Studio concepts, find API reference docs, and read tutor
Here are some popular topics to help you get started:

- [PWA Studio Overview][] - A high level overview of PWA Studio and what it provides to developers
- [PWA Studio Beginner Guide](https://www.youtube.com/watch?v=n8C87KQT-Bg)
- [Tools and libraries][] - A list of tools and libraries developers need to be familiar with to use PWA Studio
- [PWA Studio fundamentals][] - A series of tutorials covering common storefront development tasks
- [PWA Studio best Practices](https://developer.adobe.com/commerce/pwa-studio/guides/best-practices/)


### Venia

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Object {
"error": undefined,
"guestSignInUsername": "",
"handlePlaceOrder": [Function],
"handlePlaceOrderEnterKeyPress": [Function],
"handleReviewOrder": [Function],
"handleReviewOrderEnterKeyPress": [Function],
"hasError": false,
Expand Down
10 changes: 10 additions & 0 deletions packages/peregrine/lib/talons/CheckoutPage/useCheckoutPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const CHECKOUT_STEP = {
* customer: Object,
* error: ApolloError,
* handlePlaceOrder: Function,
* handlePlaceOrderEnterKeyPress: Function,
* hasError: Boolean,
* isCartEmpty: Boolean,
* isGuestCheckout: Boolean,
Expand Down Expand Up @@ -250,6 +251,14 @@ export const useCheckoutPage = (props = {}) => {
setIsPlacingOrder(true);
}, [cartId, getOrderDetails]);

const handlePlaceOrderEnterKeyPress = useCallback(() => {
event => {
if (event.key === 'Enter') {
handlePlaceOrder();
}
};
}, [handlePlaceOrder]);

const [, { dispatch }] = useEventingContext();

// Go back to checkout if shopper logs in
Expand Down Expand Up @@ -386,6 +395,7 @@ export const useCheckoutPage = (props = {}) => {
error: checkoutError,
guestSignInUsername,
handlePlaceOrder,
handlePlaceOrderEnterKeyPress,
hasError: !!checkoutError,
isCartEmpty: !(checkoutData && checkoutData?.cart?.total_quantity),
isGuestCheckout: !isSignedIn,
Expand Down
3 changes: 3 additions & 0 deletions packages/venia-ui/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"filterModal.item.clearFilter": "Remove filter \"{optionName}\".",
"filterModal.item.hideOptions": "Hide \"{itemName}\" filter item options.",
"filterModal.item.showOptions": "Show \"{itemName}\" filter item options.",
"filterModalOpenButton.ariaLabel": "Filter Button for Filter Options.",
"filterSearch.name": "Enter a {name}",
"footer.calloutText": "Lorem ipsum dolor sit amet, consectetur adipsicing elit, sed do eiusmod tempor incididunt ut labore et dolore.",
"footer.followText": "Follow Us!",
Expand Down Expand Up @@ -373,6 +374,8 @@
"productQuantity.label": "product's quantity",
"productSort.sortByButton": "Sort by",
"productSort.sortButton": "Sort",
"productSort.sortButtonCollapsed": "Sort Button Collapsed",
"productSort.sortButtonExpanded": "Sort Button Expanded",
"quantity.buttonDecrement": "Decrease Quantity",
"quantity.buttonIncrement": "Increase Quantity",
"quantity.input": "Item Quantity",
Expand Down
2 changes: 2 additions & 0 deletions packages/venia-ui/lib/components/CheckoutPage/checkoutPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const CheckoutPage = props => {
error,
guestSignInUsername,
handlePlaceOrder,
handlePlaceOrderEnterKeyPress,
hasError,
isCartEmpty,
isGuestCheckout,
Expand Down Expand Up @@ -272,6 +273,7 @@ const CheckoutPage = props => {
checkoutStep === CHECKOUT_STEP.REVIEW ? (
<Button
onClick={handlePlaceOrder}
onKeyDown={handlePlaceOrderEnterKeyPress}
priority="high"
className={classes.place_order_button}
data-cy="CheckoutPage-placeOrderButton"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { shape, string, array } from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { FormattedMessage, useIntl } from 'react-intl';
import Button from '../Button';
import { useStyle } from '../../classify';
import defaultClasses from './filterModalOpenButton.module.css';
Expand All @@ -10,7 +10,12 @@ const FilterModalOpenButton = props => {
const { filters, classes: propsClasses } = props;
const classes = useStyle(defaultClasses, propsClasses);
const { handleOpen } = useFilterModal({ filters });

const handleKeypress = e => {
if (e.code == 'Enter') {
handleOpen;
}
};
const { formatMessage } = useIntl();
return (
<Button
priority={'low'}
Expand All @@ -19,9 +24,14 @@ const FilterModalOpenButton = props => {
}}
data-cy="FilterModalOpenButton-button"
onClick={handleOpen}
onKeyDown={handleKeypress}
type="button"
aria-live="polite"
aria-busy="false"
aria-label={formatMessage({
id: 'filterModalOpenButton.ariaLabel',
defaultMessage: 'Filter Button for Filter Options'
})}
>
<FormattedMessage
id={'productList.filter'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ exports[`it does not render order details if loading is true 1`] = `
/>
</div>
<button
aria-expanded={false}
className="contentToggleContainer"
onClick={[MockFunction handleContentToggle]}
type="button"
Expand Down Expand Up @@ -285,6 +286,7 @@ exports[`it renders collapsed order row 1`] = `
/>
</div>
<button
aria-expanded={false}
className="contentToggleContainer"
onClick={[MockFunction handleContentToggle]}
type="button"
Expand Down Expand Up @@ -571,6 +573,7 @@ exports[`it renders open order row 1`] = `
/>
</div>
<button
aria-expanded={true}
className="contentToggleContainer"
onClick={[MockFunction handleContentToggle]}
type="button"
Expand Down Expand Up @@ -867,6 +870,7 @@ exports[`it renders with missing order information 1`] = `
/>
</div>
<button
aria-expanded={false}
className="contentToggleContainer"
onClick={[MockFunction]}
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const OrderRow = props => {
className={classes.contentToggleContainer}
onClick={handleContentToggle}
type="button"
aria-expanded={isOpen}
>
{contentToggleIcon}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ exports[`renders correctly 1`] = `
aria-busy="false"
>
<button
aria-label="Sort Button Collapsed"
disabled={false}
onClick={[Function]}
onDragStart={[Function]}
Expand Down
17 changes: 17 additions & 0 deletions packages/venia-ui/lib/components/ProductSort/productSort.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,21 @@ const ProductSort = props => {
setExpanded(!expanded);
};

const handleKeypress = e => {
if (e.code == 'Enter') {
setExpanded(expanded);
}
};
const result = expanded
? formatMessage({
id: 'productSort.sortButtonExpanded',
defaultMessage: 'Sort Button Expanded'
})
: formatMessage({
id: 'productSort.sortButtonCollapsed',
defaultMessage: 'Sort Button Collapsed'
});

return (
<div
ref={elementRef}
Expand All @@ -171,6 +186,8 @@ const ProductSort = props => {
}}
onClick={handleSortClick}
data-cy="ProductSort-sortButton"
onKeyDown={handleKeypress}
aria-label={result}
>
<span className={classes.mobileText}>
<FormattedMessage
Expand Down

0 comments on commit 8531cb4

Please sign in to comment.