Skip to content

Add presentational Viewing-menu (Timeline filter) demo story - #8327

Open
janmaarten-a11y wants to merge 3 commits into
mainfrom
janmaarten-a11y-timeline-filter-viewing-menu-story
Open

Add presentational Viewing-menu (Timeline filter) demo story#8327
janmaarten-a11y wants to merge 3 commits into
mainfrom
janmaarten-a11y-timeline-filter-viewing-menu-story

Conversation

@janmaarten-a11y

@janmaarten-a11y janmaarten-a11y commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Related: #6654 (epic), #6664 (phase). Does not close an issue.

Phase 3 of the GitHub Timeline redesign. A story-first, presentational "Viewing" menu demo plus a behavior-preserving refactor so the Playground and the new demo share the same representative surface data. Stories and internal story-scaffolding only: no public API, no changeset. This adds no Timeline.Filter component; the demo composes its control inside a story.

The demo shows the prototype's per-surface "Viewing" control: an ActionMenu multi-select that toggles which event categories render in a Timeline. Filtering is 100% consumer-side; the control reads no data-* attributes. Its contract is options / selected / onSelectedChange; the story supplies the predicate and applies it. The multi-select menu stays open across toggles for mouse and keyboard, so a viewer can flip several categories in one pass. The opening and closing lifecycle bookends stay pinned outside the predicate, so the timeline never renders empty regardless of toggles, a guarantee the consumer owns, not the Timeline or the control.

The representative PLAYGROUND_SURFACES map is illustrative, github-flavored sample data, not authoritative. The canonical Timeline taxonomy lives in github-ui (@github-ui/timeline-taxonomy); a header comment in the moved module points there to prevent drift.

Changelog

New

  • Timeline.filter.features.stories.tsx: presentational "Viewing" menu demo (ActionMenu multi-select, consumer-side category filtering, pinned never-empty lifecycle bookends). It renders under Components/Timeline/Features as the WithFiltering story.
  • internal/timelinePlaygroundData.tsx: shared internal story-scaffolding module holding the representative surface data, its data-layer types, and the pure derivation helpers. Not exported from the package index.

Changed

  • Timeline.stories.tsx now imports the surface data and helpers from the new internal module. The Playground stories render identically (same DOM, controls, and filtering).
  • The local .Strong styling moves into the shared internal/timelineStoryHelpers module (a Strong helper plus its rule in timelineStoryHelpers.module.css), so the moved data and every surface story reuse one source.

Removed

  • Nothing consumer-facing. The surface data moves out of Timeline.stories.tsx, and its local .Strong rule leaves Timeline.stories.module.css for the shared helper module described above.

Rollout strategy

  • None; stories and internal story-scaffolding only. No public API change and no changeset (the skip changeset label is applied).

Testing & Reviewing

Open Storybook and view Components/Timeline/FeaturesWithFiltering. Toggle categories in the "Viewing" menu: each category's rows show or hide accordingly, the multi-select menu stays open across toggles (mouse and keyboard), and toggling every category off still leaves the pinned opening and closing bookends, so the timeline never renders empty.

Validation runs locally: tsc --noEmit clean, eslint --max-warnings=0 on the Timeline directory clean, prettier --check on changed files clean, npm run build for @primer/react succeeds, the Storybook smoke test passes, and a local interaction check confirms the Viewing menu stays open across two consecutive toggles (mouse and keyboard) with axe reporting 0 violations while the menu is open. The three-dot diff vs origin/main covers Timeline story files, the new internal/timelinePlaygroundData.tsx module, and their .module.css; it touches no packages/react/src/index.ts and adds no .changeset.

Move the Playground surface data and pure derivation helpers out of
Timeline.stories.tsx into internal/timelinePlaygroundData so both the
Playground and the new filter demo share them. Behavior is preserved:
the Playground stories render identically.

Add Timeline.filter.features.stories.tsx: an ActionMenu multi-select
"Viewing" control that filters Timeline rows consumer-side. The opening
and closing lifecycle bookends stay pinned outside the predicate so the
timeline never renders empty regardless of toggles; the consumer owns
that guarantee, not the Timeline or control components.

Story and internal scaffolding only: no public API export, no changeset.
The authoritative Timeline taxonomy stays in github-ui.
@changeset-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c05219f

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

@janmaarten-a11y janmaarten-a11y added the skip changeset This change does not need a changelog label Aug 21, 2026
@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Aug 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

Retitle the filter story to Components/Timeline/Features with export WithFiltering so it reads as a feature demo rather than implying a shipped Timeline.Filter subcomponent.

Move the semibold emphasis into a shared Strong helper in timelineStoryHelpers (mirroring BoldLink) and delete the standalone timelinePlaygroundData.module.css. The default color is load-bearing over the muted Timeline body, so the class stays rather than inlining bare Text.

Add representative per-category descriptions in the Viewing menu, rendered through ActionList.Description (block variant). The authoritative per-category text lives in github-ui timeline-taxonomy; Primer renders the slot only.

Stories and internal scaffolding only: no public API export, no changeset.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new, story-first demo for a presentational “Viewing” (Timeline filter) menu and refactors the existing Timeline Playground story scaffolding so both stories share the same representative surface/category/event sample data (kept internal to story code, not public API).

Changes:

  • Added a new Timeline filter demo story using an ActionMenu multi-select to drive consumer-side filtering of Timeline rows.
  • Extracted the Timeline Playground’s representative surface/category/event data + helper derivations into a new internal story-scaffolding module.
  • Moved “strong emphasis” styling from Timeline.stories.module.css into shared internal story helpers via a new Strong helper component.
Show a summary per file
File Description
packages/react/src/Timeline/Timeline.stories.tsx Refactors the Playground story to import shared representative data + helpers from the new internal module.
packages/react/src/Timeline/Timeline.stories.module.css Removes Playground-only .Strong styling after migrating emphasis styling to shared story helpers.
packages/react/src/Timeline/Timeline.filter.features.stories.tsx Adds the new “Viewing” menu demo story that filters Timeline rows consumer-side.
packages/react/src/Timeline/Timeline.filter.features.stories.module.css Adds minimal story-only styling for the filter demo toolbar spacing.
packages/react/src/Timeline/internal/timelineStoryHelpers.tsx Introduces a shared Strong presentational helper for semibold emphasis in event-body text.
packages/react/src/Timeline/internal/timelineStoryHelpers.module.css Adds the .Strong CSS module rule used by the new Strong helper.
packages/react/src/Timeline/internal/timelinePlaygroundData.tsx Introduces shared internal representative Timeline “playground” data + derivation helpers for stories.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 7/7 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread packages/react/src/Timeline/Timeline.filter.features.stories.tsx
Comment thread packages/react/src/Timeline/Timeline.filter.features.stories.tsx
Comment thread packages/react/src/Timeline/Timeline.filter.features.stories.tsx
Call event.preventDefault() in the multi-select ViewingFilterMenu onSelect so ActionMenu keeps its overlay open across toggles for mouse and keyboard. The prior handler let afterSelect close the menu on each item-select, contradicting the stay-open doc comment.

@liuliu-dev liuliu-dev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: Timeline integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants