Repository navigation
feat(PageNav): add XDSPageNav component with header, items, and sections - #251
Conversation
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR New ComponentsPageNav · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found. XDSPageNav - 1 issue(s)
Component PreviewsIncludes interactive hover previews as animated GIFs. XDSPageNavDefaultScreenshot: Interaction Preview: (view video) View in Storybook · Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Implements XDSPageNav v1 sidebar navigation component per issue #84. Components: - XDSPageNav: Container with five zones (header, stickyContent, scrollable children, footer, footerIcons) - XDSPageNavHeader: Product/suite/account header with smart interaction boundary logic and popover menu support - XDSPageNavItem: Nav item with icon, selected state (aria-current=page), nesting, collapsible, endContent - XDSPageNavSection: Section grouping with role=group, aria-labelledby, collapsible support Also includes: - useXDSCollapsible placeholder hook (until #187 lands) - 49 unit tests covering all components and interactions - Storybook stories with multiple variants - README documentation Co-authored-by: Navi <[email protected]>
…apsible (deferred to #187) Co-authored-by: Navi <[email protected]>
771e62a to
686e3e0
Compare
| zIndex: 1, | ||
| backgroundColor: colorVars['--color-surface'], | ||
| }, | ||
| topContent: { |
There was a problem hiding this comment.
Does this need scroll margin to clear the header? Maybe they should be sticky together?
There was a problem hiding this comment.
They already stick together — both header and topContent are inside the same stickyTop div, so they scroll as one unit. The scrollable area (flex: 1; overflowY: auto) starts below that sticky block, so no scroll-margin is needed.
| lineHeightVars, | ||
| radiusVars, | ||
| } from '../theme/tokens.stylex'; | ||
| import {useXDSPopover} from '../Layer/useXDSPopover'; |
There was a problem hiding this comment.
We can create a new issue for this but ideally we should avoid fetching layer resources unless we're sure to render them. Might need XDSPopover to accomplish this with React.lazy though. See XDSText for an example of this optimization.
There was a problem hiding this comment.
Tracked in #264. The tricky part is that useXDSPopover is a hook (not a component), so we can't React.lazy it directly. The approach would be to extract the menu-dependent rendering into a separate PageNavHeaderWithMenu component that can be lazy-loaded. Keeping it as a follow-up to avoid bloating this PR.
|
Looking pretty good. Demonstrate selected icons using their filled variant if possible. |
…ter, remove hasChevron - Replace raw <button> elements with XDSButton (ghost variant) in stories - Replace hardcoded icon sizes with XDSIcon component in stories - Wrap header + topContent in a single sticky container so they stick together - Make footer + footerIcons sticky to bottom with margin-top: auto - Replace custom <a> link styles with XDSLink in header - Remove hasChevron prop — chevron now auto-shown only when menu is provided - Add TODO(#264) for lazy-loading popover resources Co-authored-by: Navi <[email protected]>
|
In the "Suite with Independent Links" example, the popover should still appear in the same position as when there are no links, so it should be aligned relative to the full page nav header. We may need to provide separate contextRef and triggerRefs to the popover API. |
|
The clickable/hover visual for the header is too flush with the nav container. It needs to be visually at least 4px spaced from the edges. |
|
Following the design mocks in #84, the section headings should use smaller text and not be in all caps. |
- Section headings: remove uppercase/letter-spacing, use smaller text per design mocks (#84) - Header hover: add 4px inset margin so interactive area isn't flush with container edges - Suite header popover: anchor to full header div (not chevron) so popover position is consistent regardless of independent links - Stories: add selectedIcon (filled variant) to all selected items - Lazy-load popover deferred to #264 (requires component extraction, not just React.lazy)
cixzhang
left a comment
There was a problem hiding this comment.
Addressed all feedback — pushed 884e282.
Summary of changes:
- ✅ Selected icons — all stories now pass
selectedIcon(filled variant) for selected items - ✅ Suite header popover alignment — popover now anchors to the full header div via
setRef/triggerRef, not the chevron button. Position is consistent regardless of independent links. - ✅ Header hover inset — added
interactiveInsetstyle withmarginInline/marginBlockof--spacing-1(4px) so the hover/click visual is inset from container edges - ✅ Section headings — removed
textTransform: uppercaseandletterSpacing, now uses smaller text per #84 design mocks - ✅ Scroll margin / sticky — already addressed: header + topContent are wrapped in the same
stickyTopdiv, so they stick together. No scroll-margin needed since the scrollable area starts below. - ✅ Lazy-load popover — tracked in #264. Requires extracting the popover-dependent rendering into a lazy-loadable component (can't
React.lazya hook directly). Deferred to keep this PR focused.
|
Replied to all inline threads and addressed the general comments:
|
The interactiveInset margins on the header <a> were overflowing the block-level stickyTop container. Adding display:flex + flexDirection:column properly contains the margins.
With stickyTop now using display:flex, the explicit width caused the header to overflow past its inset margins. Flex children fill naturally.
Match DropdownMenu/Selector patterns: - boxShadow with --color-shadow-elevation for card elevation - borderRadius and backgroundColor on popover content - minWidth: anchor-size(width) so popover is at least as wide as header - marginBlockStart gap between trigger and popover
…ons (#251) * feat(PageNav): add XDSPageNav component with header, items, and sections Implements XDSPageNav v1 sidebar navigation component per issue #84. Components: - XDSPageNav: Container with five zones (header, stickyContent, scrollable children, footer, footerIcons) - XDSPageNavHeader: Product/suite/account header with smart interaction boundary logic and popover menu support - XDSPageNavItem: Nav item with icon, selected state (aria-current=page), nesting, collapsible, endContent - XDSPageNavSection: Section grouping with role=group, aria-labelledby, collapsible support Also includes: - useXDSCollapsible placeholder hook (until #187 lands) - 49 unit tests covering all components and interactions - Storybook stories with multiple variants - README documentation Co-authored-by: Navi <[email protected]> * refactor(PageNav): rename stickyContent to topContent and remove collapsible (deferred to #187) Co-authored-by: Navi <[email protected]> * refactor(PageNav): address review — use XDSButton/XDSLink, sticky footer, remove hasChevron - Replace raw <button> elements with XDSButton (ghost variant) in stories - Replace hardcoded icon sizes with XDSIcon component in stories - Wrap header + topContent in a single sticky container so they stick together - Make footer + footerIcons sticky to bottom with margin-top: auto - Replace custom <a> link styles with XDSLink in header - Remove hasChevron prop — chevron now auto-shown only when menu is provided - Add TODO(#264) for lazy-loading popover resources Co-authored-by: Navi <[email protected]> * fix(PageNav): address review feedback - Section headings: remove uppercase/letter-spacing, use smaller text per design mocks (#84) - Header hover: add 4px inset margin so interactive area isn't flush with container edges - Suite header popover: anchor to full header div (not chevron) so popover position is consistent regardless of independent links - Stories: add selectedIcon (filled variant) to all selected items - Lazy-load popover deferred to #264 (requires component extraction, not just React.lazy) * fix(PageNav): add flex to stickyTop to contain header inset margins The interactiveInset margins on the header <a> were overflowing the block-level stickyTop container. Adding display:flex + flexDirection:column properly contains the margins. * fix(PageNav): remove width:100% from header root With stickyTop now using display:flex, the explicit width caused the header to overflow past its inset margins. Flex children fill naturally. * fix(PageNav): add elevation shadow and min-width to header popover Match DropdownMenu/Selector patterns: - boxShadow with --color-shadow-elevation for card elevation - borderRadius and backgroundColor on popover content - minWidth: anchor-size(width) so popover is at least as wide as header - marginBlockStart gap between trigger and popover --------- Co-authored-by: Navi <[email protected]>
…ons (#251) * feat(PageNav): add XDSPageNav component with header, items, and sections Implements XDSPageNav v1 sidebar navigation component per issue #84. Components: - XDSPageNav: Container with five zones (header, stickyContent, scrollable children, footer, footerIcons) - XDSPageNavHeader: Product/suite/account header with smart interaction boundary logic and popover menu support - XDSPageNavItem: Nav item with icon, selected state (aria-current=page), nesting, collapsible, endContent - XDSPageNavSection: Section grouping with role=group, aria-labelledby, collapsible support Also includes: - useXDSCollapsible placeholder hook (until #187 lands) - 49 unit tests covering all components and interactions - Storybook stories with multiple variants - README documentation * refactor(PageNav): rename stickyContent to topContent and remove collapsible (deferred to #187) * refactor(PageNav): address review — use XDSButton/XDSLink, sticky footer, remove hasChevron - Replace raw <button> elements with XDSButton (ghost variant) in stories - Replace hardcoded icon sizes with XDSIcon component in stories - Wrap header + topContent in a single sticky container so they stick together - Make footer + footerIcons sticky to bottom with margin-top: auto - Replace custom <a> link styles with XDSLink in header - Remove hasChevron prop — chevron now auto-shown only when menu is provided - Add TODO(#264) for lazy-loading popover resources * fix(PageNav): address review feedback - Section headings: remove uppercase/letter-spacing, use smaller text per design mocks (#84) - Header hover: add 4px inset margin so interactive area isn't flush with container edges - Suite header popover: anchor to full header div (not chevron) so popover position is consistent regardless of independent links - Stories: add selectedIcon (filled variant) to all selected items - Lazy-load popover deferred to #264 (requires component extraction, not just React.lazy) * fix(PageNav): add flex to stickyTop to contain header inset margins The interactiveInset margins on the header <a> were overflowing the block-level stickyTop container. Adding display:flex + flexDirection:column properly contains the margins. * fix(PageNav): remove width:100% from header root With stickyTop now using display:flex, the explicit width caused the header to overflow past its inset margins. Flex children fill naturally. * fix(PageNav): add elevation shadow and min-width to header popover Match DropdownMenu/Selector patterns: - boxShadow with --color-shadow-elevation for card elevation - borderRadius and backgroundColor on popover content - minWidth: anchor-size(width) so popover is at least as wide as header - marginBlockStart gap between trigger and popover ---------
Summary
Implements XDSPageNav v1 sidebar navigation component per #84.
Components
XDSPageNav
Container with five zones stacked vertically:
header(sticky) — typically XDSPageNavHeaderstickyContent(sticky) — buttons, pinned itemschildren(scrollable) — nav sections and itemsfooter— promo cards, etc.footerIcons— icon buttons at bottomXDSPageNavHeader
Product/suite/account header with smart interaction boundary logic:
<a>, chevron is the triggerComposes
useXDSPopoverinternally whenmenuis provided.XDSPageNavItem
Navigation item with:
icon/selectedIcon(XDSIconType)isSelected→ accent background pill +aria-current="page"isDisabled,href,onClick,endContentchildren+collapsiblepropXDSPageNavSection
Section grouping with:
title,subtitle,endContentcollapsibleprop for expand/collapseisHeaderHiddenfor visually hidden but accessible headersrole="group"witharia-labelledbyAlso includes
useXDSCollapsibleplaceholder hook (until useXDSCollapsible hook + collapsible prop pattern #187 lands)Accessibility
<nav aria-label="Page navigation">aria-current="page"on selected itemsrole="group"witharia-labelledbyon sectionsaria-expandedon collapsible triggersDependencies
Crafted with care by Navi