accept RAC props for toggle button components and add disabled style - #94
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR extends the toggle button components to accept React Aria props, adds a visual disabled style, updates snapshots to reflect new styling, and introduces a story for disabled state.
- Extend
ToggleButtonGroupPropsand item definitions to inherit fromreact-aria-componentsprops - Add
[data-disabled]styling in CSS and bump version - Update storybook with a Disabled example and refresh snapshots
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/components/snapshots/ToggleButtonGroup.spec.tsx.snap | Updated className hashes due to style tweaks |
| src/components/ToggleButtonGroup/styles.ts | Added disabled state color style |
| src/components/ToggleButtonGroup/index.tsx | Extended props to include RAC props, refactored item mapping |
| src/components/ToggleButtonGroup.stories.tsx | Added Disabled story to demo isDisabled usage |
| package.json | Bumped version to 1.18.1 |
Comments suppressed due to low confidence (3)
src/components/ToggleButtonGroup/index.tsx:27
- Ensure the underlying
<button>receives adisabledprop (oraria-disabled) whenitemProps.isDisabledis true so that browsers and assistive technologies enforce the disabled behavior.
{...itemProps}
src/components/ToggleButtonGroup.stories.tsx:42
- We should add a unit or snapshot test for the Disabled state to verify that the disabled styling and interaction behavior are applied correctly.
export const Disabled = () => {
src/components/ToggleButtonGroup.stories.tsx:43
- Initializing
selectedItemto an empty string yields a Set with""as a key, which doesn’t match any button id. Consider starting with a valid id orundefinedto avoid an empty-selection key.
const [selectedItem, setSelectedItem] = React.useState('');
jomcarvajal
approved these changes
Jun 26, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
https://openstax.atlassian.net/browse/CORE-1027
I need to set RAC props on this component in assignments, like isDisabled on both the group and the button.