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

AC-2487::Accordions do not indicate current state #3977

Merged
merged 11 commits into from
Nov 15, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ 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;
}
};

return (
<Button
Expand All @@ -19,9 +24,11 @@ const FilterModalOpenButton = props => {
}}
data-cy="FilterModalOpenButton-button"
onClick={handleOpen}
onKeyDown={handleKeypress}
type="button"
aria-live="polite"
aria-busy="false"
aria-label="Filter Button for Filter Options"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a translation for this string please?

>
<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
9 changes: 9 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,13 @@ const ProductSort = props => {
setExpanded(!expanded);
};

const handleKeypress = e => {
if (e.code == 'Enter') {
setExpanded(expanded);
}
};
const result = expanded ? 'Sort Button Expanded' : 'Sort Button Collapsed';
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you add translations for these strings please?


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