Docs: Edit JSON button is now accessible at 320x256 viewport (WCAG 2.1 Reflow test)#33707
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughReplaces the Object control's plain "Edit JSON" trigger with an icon-plus-text button, adds responsive container-query and media-rule styling to reflow/hide text on small viewports, centralizes and exports an Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
code/addons/docs/src/blocks/controls/Object.tsx (1)
254-266: ariaLabel implementation looks good, but spacing between icon and text needs explicit definition.The
ariaLabelwith the dynamic name property correctly follows the Button component convention (extends ButtonProps). However, the RawButton styling doesn't explicitly define a gap between the EditIcon and span elements. Add explicit gap spacing to ensure consistent alignment:const RawButton = styled(ToggleButton)({ flexShrink: 0, + gap: '4px', // Hide text on small screens, show only icon for accessibility (WCAG 2.1 Reflow) '@media (max-width: 400px)': { '& > span': { display: 'none', }, }, });The ariaLabel properly ensures accessibility when text is hidden on small screens, and the icon+text pattern is sound.
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
|
Thank you for opening the PR! As you can see here, it seems like the |
…ns, use column layout on small screens for WCAG 2.1 Reflow
|
Hi @valentinpalkovic, I've updated the implementation based on your feedback. On large screens, I restored the original position: absolute layout, so the Edit JSON button is back in the top-right corner as before. On small screens (320×256, WCAG 2.1 Reflow), the wrapper switches to flex-direction: column, the button becomes position: static with align-self: flex-end, and the text is hidden so only the icon is shown. The layout stays unchanged on normal screens while remaining accessible on small viewports. |
|
Great! Thanks for addressing the feedback. Could you add another set of stories for I would like to get a design review from @MichaelArestad. Questions:
|
|
Thanks! I will add the small viewport stories for Chromatic coverage.
|
|
I added small viewport stories (320px) for Chromatic coverage. |
Sidnioulz
left a comment
There was a problem hiding this comment.
Thanks for tackling this ❤️
We need a few changes to preserve the screenreader experience and to make your change apply more broadly.
Please re-request a review once you've made the changes. Thanks!
|
Thanks for the review @Sidnioulz! I have made the requested changes:
|
|
Thank you so much for the iteration. Would you mind fixing the Eslint/Prettier errors? |
Closes #24149
Edit JSON button is now accessible at 320x256 viewport (WCAG 2.1 Reflow test).
Changes Made
Related Issue
Fixes #24149
Checklist
Summary by CodeRabbit
New Features
Style
Accessibility