Skip to content

Add BranchName WithTrailingAction story#7920

Open
siddharthkp wants to merge 3 commits into
mainfrom
siddharthkp/branchname-trailing-action-story
Open

Add BranchName WithTrailingAction story#7920
siddharthkp wants to merge 3 commits into
mainfrom
siddharthkp/branchname-trailing-action-story

Conversation

@siddharthkp

@siddharthkp siddharthkp commented Jun 3, 2026

Copy link
Copy Markdown
Member
  • part 1 of 2 of github/primer#6684
  • My goal with this PR is to first implement it as a story and then in another PR "upstream" it into the component

Overview

Adds a feature story demonstrating the trailing action pattern (copy button) for BranchName. This story serves as a reference for the implementation work to upstream this pattern from github-ui's PullRequestBranchName.

The story demonstrates:

  • Copy button with divider line
  • Hover/focus states
  • Copied state feedback (icon change + tooltip)
  • Accessible announcements via VisuallyHidden + Announce

Changelog

New

  • WithTrailingAction story in BranchName features

Changed

None

Removed

None

Rollout strategy

  • None; story-only change, no component changes yet

Testing & Reviewing

View the story in Storybook: Components > BranchName > Features > With Trailing Action

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

@changeset-bot

changeset-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: fd4ede3

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

@github-actions github-actions Bot added the staff Author is a staff member label Jun 3, 2026
@siddharthkp siddharthkp added the skip changeset This change does not need a changelog label Jun 3, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 3, 2026 11:02 Inactive
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 4, 2026 09:06 Inactive
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 8, 2026 11:13 Inactive
@siddharthkp siddharthkp added integration-tests: skipped manually Changes in this PR do not require an integration test update snapshots 🤖 Command that updates VRT snapshots on the pull request and removed update snapshots 🤖 Command that updates VRT snapshots on the pull request labels Jun 8, 2026
@github-actions github-actions Bot requested a deployment to storybook-preview-7920 June 8, 2026 11:24 Abandoned
@github-actions github-actions Bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 8, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 8, 2026 11:40 Inactive
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 8, 2026 11:53 Inactive
@siddharthkp siddharthkp added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 8, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 8, 2026 12:08 Inactive
@github-actions github-actions Bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 8, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 8, 2026 12:19 Inactive
@siddharthkp siddharthkp added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 10, 2026
@github-actions github-actions Bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 10, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 10, 2026 09:24 Inactive
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 10, 2026 09:34 Inactive
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 10, 2026 09:48 Inactive
Demonstrate a trailing action pattern (copy button) for BranchName,
serving as a reference for future implementation work.

Add WithTrailingActionMenu story with SelectPanel

Demonstrates branch switching via SelectPanel anchored to BranchName,
showing the 'Change base branch' pattern.

Remove overflow:hidden to prevent focus ring clipping
@siddharthkp siddharthkp force-pushed the siddharthkp/branchname-trailing-action-story branch from 9957e42 to aad16e8 Compare June 10, 2026 09:56
@siddharthkp siddharthkp added the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 10, 2026
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 10, 2026 09:57 Inactive
@github-actions github-actions Bot temporarily deployed to storybook-preview-7920 June 10, 2026 10:05 Inactive
@github-actions github-actions Bot removed the update snapshots 🤖 Command that updates VRT snapshots on the pull request label Jun 10, 2026
@siddharthkp siddharthkp marked this pull request as ready for review June 10, 2026 11:32
@siddharthkp siddharthkp requested a review from a team as a code owner June 10, 2026 11:32
@siddharthkp siddharthkp requested review from Copilot, joshblack and llastflowers and removed request for Copilot June 10, 2026 11:32

@joshblack joshblack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just had one comment for the live region announcements but wanted to approve in advance so you didn't have to wait another day lol

{/* Screen reader announcement for copy success */}
{copied && (
<VisuallyHidden>
<Announce>Copied!</Announce>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The announcement might be better suited in handleCopy with announce straight from @primer/live-region-element instead of rendering it, in particular if the announcement is hidden. e.g.

import { announce } from '@primer/live-region-element'

 const handleCopy = () => {
    setCopied(true)
    void navigator.clipboard.writeText(branchName)
    announce('Copied!');
    setTimeout(() => setCopied(false), 2000)
  }

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

Labels

integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants