-
Notifications
You must be signed in to change notification settings - Fork 216
Add dropdown display style to Attribute Filter block #1255
Conversation
a0024ac to
63f189b
Compare
|
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. |
nerrad
left a comment
There was a problem hiding this 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:
- 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 }> |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
Oh I also forgot to add that when I run |
e618124 to
da9ac3b
Compare
|
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.
Fixed in 5a6b7eb.
Fixed in 85c3cfd.
I was sure I added it but it looks like I didn't. 🤦♂️ Done in f313d65. |
nerrad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
efb38f9 to
f5b7e57
Compare
Good catch! I missed the case when menu was closed. Should be fixed in f5b7e57.
The GIF was helpful, thank you! I think I misunderstood you in the previous message. This issue should be fixed in de78883. |
nerrad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎈 🎉 🌮 .... ![]()
f5b7e57 to
667838f
Compare
|
@Aljullu I think having the apply button as optional (but turned off), makes a lot of sense. Great work! |



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 betweenORandAND).I plan to implement the
ANDformat in a follow-up, but wanted to get feedback early before starting with it.Accessibility
Screenshots
How to test the changes in this Pull Request:
Follow-ups
ANDdropdown format will be implemented in a follow-up.Changelog