You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 5, 2026. It is now read-only.
Repository navigation
[STAR-352] [BpkBadge] Wrap BpkBadge in forwardRef - #4912
This PR is a follow up to #4896.
It wraps BpkBadge in forwardRef to expose the underlying or DOM node to consumers, following the pattern in BpkPressable.
The ref is forwarded only for interactive variants (as="button" or as="a"); the default badge does not forward a ref.
This change is needed for programmatically focus the badge after an action such as closing a bottom sheet, returning focus to the trigger.
Remember to include the following changes:
Ensure the PR title includes the name of the component you are changing so it's clear in the release notes for consumers of the changes in the version e.g [Clover-123][BpkButton] Updating the colour
The page SHOULD be functional AND readable when only the text is magnified to 200% of its initial size
Pages must reflow as zoom increases up to 400% so that content continues to be presented in only one column i.e. Content MUST NOT require scrolling in two directions (both vertically and horizontally)
For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Wraps BpkBadge with forwardRef so consumers can access the underlying DOM element for interactive badge variants (as="button" / as="a") and document that behavior.
Changes:
Wrap BpkBadge in forwardRef and pass the forwarded ref to <a> and <button> render paths.
Rename the inner implementation to BpkBadgeInner and export the forwardRef wrapper as BpkBadge.
Document ref-forwarding behavior in the component README.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
`BpkBadge` forwards its `ref` to the underlying `<button>` (when `as="button"`) or `<a>` (when `as="a"`) element. For non-interactive `<span>` badge, no ref is forwarded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BpkBadge Interactive
This PR is a follow up to #4896.
It wraps BpkBadge in forwardRef to expose the underlying or DOM node to consumers, following the pattern in BpkPressable.
The ref is forwarded only for interactive variants (
as="button"oras="a"); the default badge does not forward a ref.This change is needed for programmatically focus the badge after an action such as closing a bottom sheet, returning focus to the trigger.
Remember to include the following changes:
[Clover-123][BpkButton] Updating the colourREADME.md(If you have created a new component)README.md