Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Conversation

@Aljullu
Copy link
Contributor

@Aljullu Aljullu commented Nov 25, 2019

Part of #1134 and #1135.

This PR implements the dropdown display style for the Filter Products by Attribute block with the Query Type set to OR (see #1134 for the difference between OR and AND).

I plan to implement the AND format in a follow-up, but wanted to get feedback early before starting with it.

Accessibility

Screenshots

Peek 2019-11-25 20-03

How to test the changes in this Pull Request:

  1. Create a post with a Filter Products by Attribute block and select the Dropdown option in Display Style.
  2. Preview the post and interact with the filter (search terms, add them, remove them, repeat only using the keyboard, using a screen reader, etc.).
  3. Verify everything works as expected.

Follow-ups

  • As mentioned, the AND dropdown format will be implemented in a follow-up.
  • I didn't implement the Apply button that can be seen in the mockups. I would like to discuss with @jwold not showing it or making it optional as in the Price Filter, so instant updates can happen.

Changelog

Add dropdown display style to Filter Products by Attribute block.

@Aljullu Aljullu self-assigned this Nov 25, 2019
@Aljullu Aljullu force-pushed the add/attributefilter-dropdown-display branch 3 times, most recently from a0024ac to 63f189b Compare November 27, 2019 14:48
@Aljullu Aljullu added status: needs review type: enhancement The issue is a request for an enhancement. and removed status: in progress labels Nov 27, 2019
@Aljullu Aljullu requested a review from a team November 27, 2019 15:04
@Aljullu Aljullu marked this pull request as ready for review November 27, 2019 16:04
@nerrad
Copy link
Contributor

nerrad commented Nov 28, 2019

I'm getting validation errors on existing usage of Filter by Attribute block. Since this block has been released, I think we need to ensure there are no validation errors.

@Aljullu
Copy link
Contributor Author

Aljullu commented Nov 28, 2019

You're right @nerrad! That should be fixed in the last commit (fae6b71).

Copy link
Contributor

@nerrad nerrad left a comment

Choose a reason for hiding this comment

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

Great job and tests well 👍 I have a few comments and a couple accessibility issues. There were a number of other accessibility issues showing up using the Axe Tool Extension but I didn't list them all here. Some are related to storefront or outside the scope of this pull. Would you mind fixing the ones applying to this specific pull and maybe document others that show up (I'm even fine with creating an issue to use the tool to audit things for what needs fixed).

Accessibility issues

  • The selected item chips do not have a high enough color contrast ratio for accessibility:

Image 2019-11-29 at 6 14 23 AM

  • When I use the keyboard to remove a selected item (chip) by tabbing over the chip and hitting enter, the focus is lost from the input (and I have to hit tab again to return focus to the input). However backspacing to remove a chip works as expected.

This DropDown selector component is something that might be a good candidate for wider distribution. I wonder if we should start keeping a list of those somewhere?

<Fragment>
{ options.map( ( option, index ) => (
<Fragment key={ option.key }>
<Fragment key={ option.value }>
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why this change? I know you changed the expected shape from option.key to option.value (so option.key no longer exists`) Is this just to make it more consistent (being it is the value for the option)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no reason in fact, I modified it initially because the Downshift example was using value instead of key and to get started it was easier to modify the data structure of options.

Later, I didn't undo the change because both key and value sound good to me. But I don't mind undoing it if you think key was better.

onChange = () => {},
options = [],
} ) => {
const inputRef = useRef( null );
Copy link
Contributor

Choose a reason for hiding this comment

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

The same inputRef value is implemented on multiple inputs. Was that intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! That was probably a copy-&-paste error because <DropdownSelectorInputWrapper> was not using the inputRef prop. Removed it in 7f77564.

@nerrad
Copy link
Contributor

nerrad commented Nov 29, 2019

Oh I also forgot to add that when I run npm install in this branch, I get a package-lock.json diff (which includes the downshift install). Are you pushing package-lock.json changes?

@Aljullu Aljullu force-pushed the add/attributefilter-dropdown-display branch 4 times, most recently from e618124 to da9ac3b Compare November 29, 2019 14:07
@Aljullu
Copy link
Contributor Author

Aljullu commented Nov 29, 2019

Thanks for the review @nerrad. I fixed all issues I found in AXE related to this PR and opened an issue to audit the other blocks: #1281.

The selected item chips do not have a high enough color contrast ratio for accessibility:

Fixed in 5a6b7eb.

When I use the keyboard to remove a selected item (chip) by tabbing over the chip and hitting enter, the focus is lost from the input (and I have to hit tab again to return focus to the input). However backspacing to remove a chip works as expected.

Fixed in 85c3cfd.

Oh I also forgot to add that when I run npm install in this branch, I get a package-lock.json diff (which includes the downshift install). Are you pushing package-lock.json changes?

I was sure I added it but it looks like I didn't. 🤦‍♂️ Done in f313d65.

@Aljullu Aljullu requested a review from nerrad November 29, 2019 14:12
Copy link
Contributor

@nerrad nerrad left a comment

Choose a reason for hiding this comment

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

Color contrast is fixed.

However I still see this:

Image 2019-11-29 at 11 52 24 AM

Also, there's still a loss of focus when tabbing and hitting enter to remove a selected item - here's a gif that might help (but it doesn't show the key presses...highlighted chip is when the tab is focused on it).

Screen Recording 2019-11-29 at 11 57 AM

@Aljullu Aljullu force-pushed the add/attributefilter-dropdown-display branch from efb38f9 to f5b7e57 Compare November 29, 2019 18:08
@Aljullu
Copy link
Contributor Author

Aljullu commented Nov 29, 2019

However I still see this:

Good catch! I missed the case when menu was closed. Should be fixed in f5b7e57.

Also, there's still a loss of focus when tabbing and hitting enter to remove a selected item - here's a gif that might help (but it doesn't show the key presses...highlighted chip is when the tab is focused on it).

The GIF was helpful, thank you! I think I misunderstood you in the previous message. This issue should be fixed in de78883.

Copy link
Contributor

@nerrad nerrad left a comment

Choose a reason for hiding this comment

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

🎈 🎉 🌮 .... :shipit:

@Aljullu Aljullu force-pushed the add/attributefilter-dropdown-display branch from f5b7e57 to 667838f Compare December 2, 2019 10:28
@jwold
Copy link

jwold commented Dec 2, 2019

@Aljullu I think having the apply button as optional (but turned off), makes a lot of sense. Great work!

@Aljullu Aljullu merged commit 7ac5b29 into master Dec 3, 2019
@Aljullu Aljullu deleted the add/attributefilter-dropdown-display branch December 3, 2019 14:33
@nerrad nerrad added this to the 2.6.0 milestone May 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

type: enhancement The issue is a request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants