Skip to content

[SelectPanel] Add notice announcements to SelectPanel #6210

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

Merged
merged 4 commits into from
Jun 17, 2025

Conversation

kelsey-myers
Copy link
Contributor

@kelsey-myers kelsey-myers commented Jun 16, 2025

Closes #11748 and #5345

Changelog

image image image

New

  • Added an announcement functionality for SelectPanel notices

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

  • Added/updated tests
  • Added/updated documentation (N/A)
  • Added/updated previews (Storybook) (auto)
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge
  • (GitHub staff only) Integration tests pass at github/github (Learn more about how to run integration tests)

@Copilot Copilot AI review requested due to automatic review settings June 16, 2025 20:42
@kelsey-myers kelsey-myers requested a review from a team as a code owner June 16, 2025 20:42
@kelsey-myers kelsey-myers requested a review from hectahertz June 16, 2025 20:42
Copy link

changeset-bot bot commented Jun 16, 2025

🦋 Changeset detected

Latest commit: bcaaf37

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

github-actions bot commented Jun 16, 2025

Uh oh! @kelsey-myers, at least one image you shared is missing helpful alt text. Check your pull request body to fix the following violations:

  • Images should have meaningful alternative text (alt text) at line 9
  • Images should have meaningful alternative text (alt text) at line 11
  • Images should have meaningful alternative text (alt text) at line 13

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

@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 Jun 16, 2025
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This patch adds support for announcing notice messages in SelectPanel when it opens.

  • Imports announceFromElement and adds a ref to the notice container
  • Implements a useEffect to clear and announce the notice when open && notice
  • Adds a test to verify that the notice text is announced

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/react/src/SelectPanel/SelectPanel.tsx Added noticeRef, import of announceFromElement, and useEffect to announce notices
packages/react/src/SelectPanel/SelectPanel.test.tsx New test case to assert notice announcements
.changeset/smooth-ideas-smile.md Bumped patch version and changelog entry

Copy link
Contributor

github-actions bot commented Jun 16, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 92.33 KB (+0.05% 🔺)
packages/react/dist/browser.umd.js 92.37 KB (-0.03% 🔽)

@github-actions github-actions bot requested a deployment to storybook-preview-6210 June 16, 2025 20:46 Abandoned
@primer-integration
Copy link

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/384379

@github-actions github-actions bot temporarily deployed to storybook-preview-6210 June 16, 2025 20:59 Inactive
@github-actions github-actions bot added integration-tests: failing Changes in this PR cause breaking changes in gh/gh and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels Jun 16, 2025
@kelsey-myers
Copy link
Contributor Author

🔴 golden-jobs completed with status failure.

Failing tests are unrelated 🐸

@kelsey-myers kelsey-myers added the staff Author is a staff member label Jun 16, 2025
@kelsey-myers kelsey-myers requested a review from a team June 17, 2025 07:07
@primer primer deleted a comment from primer-integration bot Jun 17, 2025
Copy link
Member

@TylerJDev TylerJDev left a comment

Choose a reason for hiding this comment

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

Looks great, thank you for this contribution @kelsey-myers! ✨ Left a few comments, let me know what you think!

Comment on lines +429 to +432
useEffect(() => {
const announceNotice = async () => {
if (!noticeRef.current) return
const liveRegion = document.querySelector('live-region')
Copy link
Member

Choose a reason for hiding this comment

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

Would it be possible to utilize the announceText function here instead?

Copy link
Contributor Author

@kelsey-myers kelsey-myers Jun 17, 2025

Choose a reason for hiding this comment

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

@TylerJDev I did it this way becausenotice.text can either be a string or a react element, so I figured announceFromElement covers both cases? (unless you know of a way we can extract the text from the element)

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense! We can leave it as-is then 😁

@@ -739,7 +757,7 @@ function Panel({
) : null}
</div>
{notice && (
<div aria-live="polite" data-variant={notice.variant} className={classes.Notice}>
<div ref={noticeRef} aria-live="polite" data-variant={notice.variant} className={classes.Notice}>
Copy link
Member

Choose a reason for hiding this comment

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

Since we're utilizing announce, we can most likely remove the aria-live here, as it is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, updated :)

Copy link
Member

@TylerJDev TylerJDev left a comment

Choose a reason for hiding this comment

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

LGTM! ✨

@kelsey-myers kelsey-myers added this pull request to the merge queue Jun 17, 2025
Merged via the queue into main with commit a8b871b Jun 17, 2025
35 checks passed
@kelsey-myers kelsey-myers deleted the km/announce-notice-selectpanel branch June 17, 2025 14:32
@primer primer bot mentioned this pull request Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: failing Changes in this PR cause breaking changes in gh/gh staff Author is a staff member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants