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

feat(navigation-primary): add navigation primary #2171

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

zeroedin
Copy link
Collaborator

@zeroedin zeroedin commented Feb 17, 2025

Note, this is an early draft

❗ Expect many broken things.

Short list of current dev issues:

  1. Changes to rh-navigation-universal need to be moved and merged on its own branch; the component in this branch is a duplication of that effort with changes dictated in the Dec 2024 primary nav design. The intent is to merge these changes back into the previous PR. That PR will then need to merge prior to this PR.
  2. rh-navigation-item is broken out as its own component in this branch. I have been going back and forth where this component should live. The idea is that rh-navigation-item can be shared between rh-navigation-primary, rh-navigation-secondary, and potentially rh-navigation-universal for any dropdown mechanisms. However, I encountered issues with styling and API, so I am sort of backtracking that idea a little bit. Also, if rh-navigation-universal goes away with the redesign, maybe it could just continue to live in the primary folder and be shared from there to the secondary nav in the future. Note: there is potential with the redesign of the primary nav that the secondary nav could also be deprecated. Originally this component named was rh-dropdown, but I later discovered I would need to deal with both dropdowns and links in the same wrapper for style consistency. I do wonder if there is still potentially for rh-dropdown to exist here or if/how rh-dropdown may differ from rh-disclosure. We are sort of bending in between the two with navigation dropdowns.
  3. Issues with slotted universal nav into primary exist for documentation (deploy preview) demos and the lightdom CSS redirects in our tooling; this is a known issue; it works locally on the dev server :8000, but linking to another component lightdom CSS exposes this linking issue with our demos.
  4. Eventing between open dropdowns is not complete. Design direction is needed here, along with compositions of all navs (universal, primary, secondary) and how they should function together, described in the specification.
  5. API naming is not complete; any slot names/component properties are subject to discussion and change. An easy call out here is the idea of a standalone rh-navigation-item. The intent was to provide a stylable surface on the secondary-links slotted nav items. They appear different on mobile as they are their own "hamburger" menus so to speak. I'm wondering if that idea should be reversed, maybe a group attribute or something to denote belonging to a hamburger.... opinions are welcome here.
  6. rh-overlay fragment also exists in this branch, the idea is again this would be shared between rh-navigation-primary,rh-navigation-secondary, and rh-sidenav
  7. More to come here, but this is what I can remember at the time of pushing the code.

TODO

  • Implict ul > li via element internals instead of slotted lightdom. @bennypowers thank you for reminding me this is the path.

What I did

Testing Instructions

Notes to Reviewers

Copy link

changeset-bot bot commented Feb 17, 2025

⚠️ No Changeset found

Latest commit: 3f5d4f6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for red-hat-design-system failed. Why did it fail? →

Name Link
🔨 Latest commit 3f5d4f6
🔍 Latest deploy log https://app.netlify.com/sites/red-hat-design-system/deploys/67b4d7daf9fc5600084663ff

Copy link
Contributor

github-actions bot commented Feb 17, 2025

Size Change: +13.6 kB (+6.61%) 🔍

Total Size: 220 kB

Filename Size Change
./elements.js 505 B +32 B (+6.77%) 🔍
./elements/rh-navigation-item/context.js 177 B +177 B (new file) 🆕
./elements/rh-navigation-item/rh-navigation-item-menu.js 849 B +849 B (new file) 🆕
./elements/rh-navigation-item/rh-navigation-item.js 2.81 kB +2.81 kB (new file) 🆕
./elements/rh-navigation-primary/rh-navigation-primary.js 5.3 kB +5.3 kB (new file) 🆕
./elements/rh-navigation-universal/rh-navigation-universal-dropdown.js 1.58 kB +1.58 kB (new file) 🆕
./elements/rh-navigation-universal/rh-navigation-universal.js 1.94 kB +1.94 kB (new file) 🆕
./react/rh-navigation-item/rh-navigation-item-menu.js 195 B +195 B (new file) 🆕
./react/rh-navigation-item/rh-navigation-item.js 186 B +186 B (new file) 🆕
./react/rh-navigation-primary/rh-navigation-primary.js 189 B +189 B (new file) 🆕
./react/rh-navigation-universal/rh-navigation-universal-dropdown.js 203 B +203 B (new file) 🆕
./react/rh-navigation-universal/rh-navigation-universal.js 192 B +192 B (new file) 🆕
ℹ️ View Unchanged
Filename Size
./elements/rh-accordion/context.js 162 B
./elements/rh-accordion/rh-accordion-header.js 2.69 kB
./elements/rh-accordion/rh-accordion-panel.js 1.35 kB
./elements/rh-accordion/rh-accordion.js 3.21 kB
./elements/rh-alert/rh-alert.js 4.26 kB
./elements/rh-audio-player/rh-audio-player-about.js 1.8 kB
./elements/rh-audio-player/rh-audio-player-rate-stepper.js 1.85 kB
./elements/rh-audio-player/rh-audio-player-scrolling-text-overflow.js 1.53 kB
./elements/rh-audio-player/rh-audio-player-subscribe.js 1.38 kB
./elements/rh-audio-player/rh-audio-player.js 13.1 kB
./elements/rh-audio-player/rh-cue.js 1.95 kB
./elements/rh-audio-player/rh-transcript.js 2.7 kB
./elements/rh-avatar/random-pattern-controller.js 2.72 kB
./elements/rh-avatar/rh-avatar.js 2.86 kB
./elements/rh-back-to-top/rh-back-to-top.js 2.1 kB
./elements/rh-badge/rh-badge.js 1.55 kB
./elements/rh-blockquote/rh-blockquote.js 1.36 kB
./elements/rh-breadcrumb/rh-breadcrumb.js 1.5 kB
./elements/rh-button/rh-button.js 4.24 kB
./elements/rh-card/rh-card.js 3.58 kB
./elements/rh-code-block/prism.css.js 667 B
./elements/rh-code-block/prism.js 572 B
./elements/rh-code-block/rh-code-block.js 7.34 kB
./elements/rh-cta/rh-cta.js 4.04 kB
./elements/rh-dialog/rh-dialog.js 4.78 kB
./elements/rh-dialog/yt-api.js 617 B
./elements/rh-footer/rh-footer-block.js 714 B
./elements/rh-footer/rh-footer-copyright.js 362 B
./elements/rh-footer/rh-footer-links.js 1.17 kB
./elements/rh-footer/rh-footer-social-link.js 964 B
./elements/rh-footer/rh-footer-universal.js 3.99 kB
./elements/rh-footer/rh-footer.js 4.96 kB
./elements/rh-health-index/rh-health-index.js 2.35 kB
./elements/rh-icon/rh-icon.js 2.47 kB
./elements/rh-icon/ssr.js 181 B
./elements/rh-menu/rh-menu.js 1.29 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-dropdown.js 2.47 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-menu-section.js 1.3 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-menu.js 1.75 kB
./elements/rh-navigation-secondary/rh-navigation-secondary-overlay.js 571 B
./elements/rh-navigation-secondary/rh-navigation-secondary.js 5.26 kB
./elements/rh-navigation-secondary/test/fixtures.js 769 B
./elements/rh-pagination/rh-pagination.js 5.4 kB
./elements/rh-site-status/rh-site-status.js 2.5 kB
./elements/rh-skip-link/rh-skip-link.js 1.19 kB
./elements/rh-spinner/rh-spinner.js 1.38 kB
./elements/rh-stat/rh-stat.js 2.12 kB
./elements/rh-subnav/rh-subnav.js 2.73 kB
./elements/rh-surface/rh-surface.js 1.14 kB
./elements/rh-surface/test/elements.js 423 B
./elements/rh-switch/rh-switch.js 2.93 kB
./elements/rh-table/rh-sort-button.js 1.49 kB
./elements/rh-table/rh-table.js 3.48 kB
./elements/rh-tabs/context.js 160 B
./elements/rh-tabs/rh-tab-panel.js 1.04 kB
./elements/rh-tabs/rh-tab.js 3.02 kB
./elements/rh-tabs/rh-tabs.js 3.77 kB
./elements/rh-tag/rh-tag.js 2.79 kB
./elements/rh-tile/rh-tile-group.js 1.81 kB
./elements/rh-tile/rh-tile.js 5.08 kB
./elements/rh-timestamp/rh-timestamp.js 983 B
./elements/rh-tooltip/rh-tooltip.js 2.73 kB
./elements/rh-video-embed/rh-video-embed.js 4.59 kB
./lib/context/color/consumer.js 1.41 kB
./lib/context/color/controller.js 947 B
./lib/context/color/provider.js 2.18 kB
./lib/context/event.js 593 B
./lib/context/headings/consumer.js 722 B
./lib/context/headings/controller.js 1.12 kB
./lib/context/headings/provider.js 1.24 kB
./lib/DirController.js 565 B
./lib/elements/rh-context-demo/rh-context-demo.js 1.28 kB
./lib/elements/rh-context-picker/rh-context-picker.js 2.24 kB
./lib/environment.js 194 B
./lib/functions.js 175 B
./lib/I18nController.js 1.38 kB
./lib/ScreenSizeController.js 849 B
./lib/ssr-controller.js 251 B
./react/rh-accordion/rh-accordion-header.js 199 B
./react/rh-accordion/rh-accordion-panel.js 185 B
./react/rh-accordion/rh-accordion.js 215 B
./react/rh-alert/rh-alert.js 184 B
./react/rh-audio-player/rh-audio-player-about.js 191 B
./react/rh-audio-player/rh-audio-player-rate-stepper.js 213 B
./react/rh-audio-player/rh-audio-player-scrolling-text-overflow.js 214 B
./react/rh-audio-player/rh-audio-player-subscribe.js 196 B
./react/rh-audio-player/rh-audio-player.js 183 B
./react/rh-audio-player/rh-cue.js 195 B
./react/rh-audio-player/rh-transcript.js 207 B
./react/rh-avatar/rh-avatar.js 173 B
./react/rh-back-to-top/rh-back-to-top.js 183 B
./react/rh-badge/rh-badge.js 174 B
./react/rh-blockquote/rh-blockquote.js 179 B
./react/rh-breadcrumb/rh-breadcrumb.js 179 B
./react/rh-button/rh-button.js 174 B
./react/rh-card/rh-card.js 172 B
./react/rh-code-block/rh-code-block.js 181 B
./react/rh-cta/rh-cta.js 170 B
./react/rh-dialog/rh-dialog.js 203 B
./react/rh-footer/rh-footer-block.js 184 B
./react/rh-footer/rh-footer-copyright.js 187 B
./react/rh-footer/rh-footer-links.js 185 B
./react/rh-footer/rh-footer-social-link.js 193 B
./react/rh-footer/rh-footer-universal.js 188 B
./react/rh-footer/rh-footer.js 174 B
./react/rh-health-index/rh-health-index.js 184 B
./react/rh-icon/rh-icon.js 202 B
./react/rh-menu/rh-menu.js 173 B
./react/rh-navigation-secondary/rh-navigation-secondary-dropdown.js 217 B
./react/rh-navigation-secondary/rh-navigation-secondary-menu-section.js 205 B
./react/rh-navigation-secondary/rh-navigation-secondary-menu.js 199 B
./react/rh-navigation-secondary/rh-navigation-secondary-overlay.js 201 B
./react/rh-navigation-secondary/rh-navigation-secondary.js 213 B
./react/rh-pagination/rh-pagination.js 178 B
./react/rh-site-status/rh-site-status.js 181 B
./react/rh-skip-link/rh-skip-link.js 181 B
./react/rh-spinner/rh-spinner.js 175 B
./react/rh-stat/rh-stat.js 171 B
./react/rh-subnav/rh-subnav.js 175 B
./react/rh-surface/rh-surface.js 175 B
./react/rh-switch/rh-switch.js 185 B
./react/rh-table/rh-sort-button.js 213 B
./react/rh-table/rh-table.js 174 B
./react/rh-tabs/rh-tab-panel.js 181 B
./react/rh-tabs/rh-tab.js 187 B
./react/rh-tabs/rh-tabs.js 174 B
./react/rh-tag/rh-tag.js 182 B
./react/rh-tile/rh-tile-group.js 183 B
./react/rh-tile/rh-tile.js 194 B
./react/rh-timestamp/rh-timestamp.js 176 B
./react/rh-tooltip/rh-tooltip.js 175 B
./react/rh-video-embed/rh-video-embed.js 227 B
./uxdot/uxdot-best-practice.js 742 B
./uxdot/uxdot-copy-button.js 1.2 kB
./uxdot/uxdot-copy-permalink.js 1.1 kB
./uxdot/uxdot-example.js 1.17 kB
./uxdot/uxdot-feedback.js 727 B
./uxdot/uxdot-header.js 1.07 kB
./uxdot/uxdot-hero.js 680 B
./uxdot/uxdot-installation-tabs.js 675 B
./uxdot/uxdot-masthead.js 809 B
./uxdot/uxdot-pattern-ssr-controller-client.js 604 B
./uxdot/uxdot-pattern-ssr-controller-server.js 1.68 kB
./uxdot/uxdot-pattern-ssr-controller.js 213 B
./uxdot/uxdot-pattern.js 2.12 kB
./uxdot/uxdot-repo-status-checklist.js 1.16 kB
./uxdot/uxdot-repo-status-list.js 1.07 kB
./uxdot/uxdot-repo-status-table.js 782 B
./uxdot/uxdot-repo.js 1.17 kB
./uxdot/uxdot-search.js 2.39 kB
./uxdot/uxdot-sidenav.js 2.67 kB
./uxdot/uxdot-spacer-tokens-table.js 2.45 kB
./uxdot/uxdot-toc.js 1.13 kB

compressed-size-action

@bennypowers
Copy link
Member

Thanks for pushing this branch, @zeroedin. I'm interested in learning more about the issues you had with rh-disclosure, because it would be good to recycle that as much as possible. Perhaps there's room for rh-menu, rh-dropdown, etc, (implementing the required aria patterns) with a common controller between them?

@zeroedin
Copy link
Collaborator Author

Thanks for pushing this branch, @zeroedin. I'm interested in learning more about the issues you had with rh-disclosure, because it would be good to recycle that as much as possible. Perhaps there's room for rh-menu, rh-dropdown, etc, (implementing the required aria patterns) with a common controller between them?

I felt like the changes that were to be requested were beyond the scope of what a simple disclosure would do, and the styles needed were also quite different. I also needed an element that handled dropdowns and slotted links, so I settled on rh-navigation-item rather than rh-navgiation-dropdown as not all elements in the menu are disclosure/dropdown but shared styles between. This does not mean we can't take a much deeper look at this and look at how, if possible, to return to that idea and try again or apply a controller as you suggested.

this._details.open = false;
}

public open() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should there be a declarative way to open a navigation item?

I want to lean towards no as an answer, and this may be where this details summary implementation splits from an rh-disclosure, which can be set to open on page load by default.

I'm unsure of a use case where you would want the navigation to auto-load with a dropdown open declaratively. I think that might confuse a user when they do not trigger the interaction, as well it would "hide" content below it, unlike a disclosure, which pushes it down.

I can see this behavior for jump links nav or an accordion/disclosure where you would potentially follow a #hash link to that section of the page, and you would want the disclosure open, but hiding page content with an open nav on load might be where my opinion splits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants