Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Minor Nav Refactor + Fix for Overlapping Dropdown Menus #1160

Merged
merged 4 commits into from
Apr 26, 2020

Conversation

sghoweri
Copy link
Contributor

This PR makes two basic changes to the Nav in Pattern Lab's UIKit:

  1. It starts to tackle the overall Nav refactor I started in UIKit Nav Cleanup #1102 by breaking apart the existing Nav UI into smaller, more manageable pieces, but without any visual or functional changes. This should help make any additional Nav refactor work a lot more palatable.

  2. It fixes the annoying bug of having overlapping dropdown menus (on larger screens while the Nav is in Horizontal mode).

CleanShot 2020-04-25 at 10 59 52

@coveralls
Copy link

coveralls commented Apr 25, 2020

Coverage Status

Coverage remained the same at 73.388% when pulling 7a8b418 on feature/nav-ui-refactor into ff18eb5 on dev.

@JosefBredereck
Copy link
Contributor

I made a little test with the netlify preview. Seems that the sidebar layout is broken due to these changes. Pattern groups cannot be opened.

@sghoweri
Copy link
Contributor Author

I made a little test with the netlify preview. Seems that the sidebar layout is broken due to these changes. Pattern groups cannot be opened.

Oof. Can't believe I missed that. 🤦‍♂️

Pushing up a fix!

@sghoweri
Copy link
Contributor Author

I made a little test with the netlify preview. Seems that the sidebar layout is broken due to these changes. Pattern groups cannot be opened.

That's also a reminder to myself that we need to get some UI regression tests in place (Jest + Nightwatch or perhaps Cypress).

@sghoweri
Copy link
Contributor Author

I made a little test with the netlify preview. Seems that the sidebar layout is broken due to these changes. Pattern groups cannot be opened.

@JosefBredereck all set with the fix for this

@mfranzke
Copy link
Contributor

That's also a reminder to myself that we need to get some UI regression tests in place (Jest + Nightwatch or perhaps Cypress).

additionally to add to that list: https://github.com/garris/BackstopJS for visual regressions with simple interactions (click and hover) on elements.

@JosefBredereck JosefBredereck self-assigned this Apr 25, 2020
@JosefBredereck
Copy link
Contributor

Wouldn't it be a good chance to reactor the pl-nav component to be a lit component?

Also I would like to merge this one before #1143 because there are also changes in this file and the conflict will be easier to resolve this way.

Comment on lines +231 to +236
this.topLevelTriggers.forEach(trigger => {
if (trigger !== target) {
trigger.classList.remove('pl-is-active');
trigger.nextSibling.classList.remove('pl-is-active');
}
});
Copy link
Contributor

Choose a reason for hiding this comment

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

If you walk through all trigger, why you need to remove the pl-is-active class from the next sibling?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This chunk of code was just copied over from what we were already doing in the full Nav cleanup method.

Keep in mind that despite changing how the Nav was previously being rendered, much of the current code here hasn't been fully refactored (hence there's still some cruft to clean up like what you're pointing out here).

Comment on lines +10 to +15
const nonViewAllItems = elem.noViewAll
? children.filter(item => item.patternName !== 'View All')
: children.filter(
item =>
item.patternName !== 'View All' && !item.patternName.includes(' Docs')
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Im not shure where patterns with Docs come from, I cant find anything in the core package regarding this pattern name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. This was something I started to play around with (upstream from Pattern Lab) in the Bolt Design System.

Basically it's a yet to be documented feature that lets you replace the generic "View All" template with something a bit more custom (ie. extra info like the component name, description, status, etc).

@sghoweri
Copy link
Contributor Author

Wouldn't it be a good chance to reactor the pl-nav component to be a lit component?

@JosefBredereck In an ideal world? Maybe. However keep in mind that I'm trying to be pragmatic (and realistic) here and not bite off more work than I know I have time to see things through.

This PR isn't meant to be an entire refactor of the Nav (which takes a lot more time and requires extensively more testing as I realized the last time I tried to tackle everything all at once).

Rather, this PR is meant to make it a lot easier and more manageable to incrementally refactor the Nav (and migrate over to LitElement). That's precisely why I held back making any additional code changes than the minimum required to get something we can ship very quickly.

Also I would like to merge this one before #1143 because there are also changes in this file and the conflict will be easier to resolve this way.

Agreed -- this is meant to be super quick to merge down (and should make it super easy to resolve merge conflicts in your other PR).

I want to make sure we're careful with #1143 so we don't unintentionally cause regressions downstream.

@JosefBredereck
Copy link
Contributor

Ok, if there is nothing to add, then I will approve this change.

@sghoweri
Copy link
Contributor Author

Ok, if there is nothing to add, then I will approve this change.

Thanks @JosefBredereck, really appreciate it.

@sghoweri sghoweri merged commit 190b494 into dev Apr 26, 2020
@sghoweri sghoweri deleted the feature/nav-ui-refactor branch April 26, 2020 17:00
@bmuenzenmeyer
Copy link
Member

I want to make sure we're careful with #1143 so we don't unintentionally cause regressions downstream.

agreed - i've been reading through this a lot and have thoughts, but want to test it all more first before weighing in. Excited at all the fixes this proposal introduces, but the change to sort and flatt pattern behavior is flexing my working understanding of how the nav should work.

antonia-rose pushed a commit to quelltexterin/nemo-uikit-workshop that referenced this pull request Apr 12, 2023
…efactor

Minor Nav Refactor + Fix for Overlapping Dropdown Menus
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants