-
Notifications
You must be signed in to change notification settings - Fork 685
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
Layered Navigation - Desktop Optimizations #3137
Layered Navigation - Desktop Optimizations #3137
Conversation
…rch layout and styles for sidebar, keep filter accordion open if selected or in first 3 (magento#3115)
…nd add icon, implement show more/less in filter list, scroll to top on apply filter, add total number of results in toolbar, add filter header
… move productSort styles to productSort component (magento#3115)
|
Not sure if this is a graphql issue or expected. On https://pr-3137.pwa-venia.com/shop-the-look.html?page=1 you start out with 10 Results Clicking the first price filter cuts down the results to 2 Enabling the second filter I would anticipate seeing all products again. However it is still stuck at 2 |
Just to confirm selecting multiple price bands seems to be problematic prior to this PR - for example https://pr-3146.pwa-venia.com/shop-the-look.html?page=1&price%5Bfilter%5D=100-200%2C100_200&price%5Bfilter%5D=0-100%2C0_100 |
|
ec880c4
to
66d3ec2
Compare
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.
This looks great! Thank you so much for your patience while we worked to get the accessibility PR merged. I've left some feedback for you! A large number of the comments are just me identifying a prop rename, but there are a few things in here I'd like to see addressed if possible.
Please let me know if you have time to address this review or if you need someone on the internal team to take it over from here.
@@ -1,5 +1,5 @@ | |||
.root { | |||
--stroke: var(--venia-global-color-border); | |||
--stroke: rgb(var(--venia-global-color-border)); |
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.
Just an FYI, this might conflict with a fix incoming in #3171.
cc @tjwiebell
packages/venia-ui/lib/components/FilterModal/FilterList/filterList.js
Outdated
Show resolved
Hide resolved
packages/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.js
Outdated
Show resolved
Hide resolved
packages/venia-ui/lib/components/FilterSidebar/filterSidebar.js
Outdated
Show resolved
Hide resolved
*/ | ||
const FilterSidebar = props => { | ||
const { filters, filtersOpen } = props; | ||
const talonProps = useFilterModal({ filters }); |
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.
We don't have this really documented anywhere, and we've recently run into this with the WishlistButton
work, but the relationship between talons and components is 1:1 to avoid breaking changes within the talon affecting a related component that isn't quite identical to the original component.
So instead of reusing useFilterModal
we should create a new talon called useFilterSidebar
that is a duplicate of the other. You'll then want to put the sidebar-specific logic such as the handleApplyFilter
callback creation within this new talon.
I appreciate your attempt at re-use here, and one day we might have a better example of generalized logic, but for now just create the unique talon please :)
Edit:
As a followup, I was curious if you attempted to try to reuse/rename FilterModal
and just have a mobile view vs desktop view. I assume the differences warranted the new component, but still curious :)
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.
@sirugh It hurts to duplicate that much code, but I'll do it for you ;). The state should hopefully cross over since it's essentially based off of the URL, but I'll test to be sure.
The work is slightly based off of one of our projects and their approach was to use the same component. However there were too many "if" conditions for it to be maintainable long term, so we went for the approach of having a separate component.
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.
It hurts to duplicate that much code
I know :/ but the alternative is bug surface (for now). Eventually we will have a pattern for duplicated logic for talons, but we don't want to solve that here :)
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.
Ok, good to go again.
@JustinConabreeAbsolunet do you have time to add test coverage to the new functionality? Looks like the CI is failing due to a ~1% drop in coverage. If you don't have time to do it we can get an internal developer to do it, so no worries - just let me know what works for you. Thanks! |
@sirugh Sure! I'll get that done today. |
@sirugh I copied over the useFilterModal test to the useFilterSidebar since the functionality is the same. And I added two new tests for the useFilterList and useFilterBlock. I think it's passing now. Let me know if you need more tests |
Thanks Justin, we're almost there! If you click the details link you can see what is causing the decrease. I think at a minimum we require 0% loss of coverage to files with tests, but I can't find our config... |
@sirugh yeah I saw right after posting the message. There was just enough delay for the coveralls test. |
…t/desktop-layered-nav-optimizations
…com:JustinConabreeAbsolunet/pwa-studio into absolunet/desktop-layered-nav-optimizations
…t/desktop-layered-nav-optimizations
@JustinConabreeAbsolunet Thanks Justin, I have this observation in Lighthouse. There is a new warning introduced Note: Refactored functional tests to accommodate mobile specific selectors, due to duplication in the DOM. |
Hi @anthoula , Unfortunately this is a byproduct of duplicating the dom of the layered nav for mobile and desktop. This is the same approach that was done with the mega-menu, and there's no good way to get around it while supporting SSR. I'm open for suggestions, but this was the approach discussed with the PWA Studio team before we started the implementation, since there's nothing in place yet to handle different markup between desktop and mobile. |
@JustinConabreeAbsolunet Second observation: Search for Related Observation: Search for |
@anthoula This seems to be caused by the search bar still being open and trapping the click elsewhere on the page. If you click elsewhere and then on the filter it works correctly. This seems to have been the case prior to this PR as well In my opinion it should be a separate issue, but I can work on it in this PR if you need. |
Thanks for the contribution @JustinConabreeAbsolunet ! We will take a closer look at these items in a separate ticket. |
…t/desktop-layered-nav-optimizations
…t/desktop-layered-nav-optimizations
…t/desktop-layered-nav-optimizations
QA approved |
Description
Related Issue
Closes #3115
Acceptance
Verification Stakeholders
Specification
Verification Steps
Screenshots / Screen Captures (if appropriate)
Checklist
[ ] I have added tests to cover my changes, if necessary.
[x] I have updated existing tests to cover my changes, if necessary.
[x] I have added translations for new strings, if necessary.
[x] I have updated the documentation accordingly, if necessary.