Repository navigation
feat(ui-banner): add Banner component - #2779
git-nandor wants to merge 6 commits into
Conversation
|
Visual regression reportCypress suite: ✅ Passing Visual diff: ✅ No changes.
Accessibility (axe): ✅ No violations. 📊 View full report — click a screenshot's ⚠ badge to see each violation boxed on the image, with the offending element named and contrast failures shown as color swatches. Baselines come from the |
cad3ddc to
d965f74
Compare
| ...rest | ||
| } = props | ||
|
|
||
| const [open, setOpen] = useState(true) |
There was a problem hiding this comment.
its a bit of an edge case, but <Banner open={false} shows the Banner. I think its OK, since there is no code to open a closed banner, so it does not make sense to render a Banner, that is always closed.
matyasf
left a comment
There was a problem hiding this comment.
overall it looks good, but there are a couple of smaller changes needed
| // JAWS ignores `aria-relevant` and reads the removed node unless the | ||
| // attributes are removed and reapplied |
There was a problem hiding this comment.
This is very likely not true! The comment is copied from Alert, which copied it from Canvas from a 2016 (!!) commit https://github.com/instructure/canvas-lms/blob/master/ui/shared/rails-flash-notifications/jquery/helper.ts#L156
Please test this in JAWS and remove it (from Alert too!) if its not needed
There was a problem hiding this comment.
Thanks you're right. The node removal was missing, and the attributes were immediately added back. React only removes the node afterwards, so the code wasn't actually doing anything.
|
|
||
| if (transition === 'none') { | ||
| return open ? ( | ||
| <Fragment> |
There was a problem hiding this comment.
Do not use <Fragment>, use just <>, this is our convention
| /** | ||
| * The first row of the Banner, displayed above the content. | ||
| */ | ||
| title?: ReactNode |
There was a problem hiding this comment.
Cant we make this just a string? We can widen the type later if needed
| /** | ||
| * Close button label, setting it renders the close button. | ||
| */ | ||
| renderCloseButtonLabel?: Renderable |
There was a problem hiding this comment.
Cant we make this just a string? We can widen the type later if needed
| The Banner component highlights a non-urgent message, like a new feature or a | ||
| tip. For status messages (info, success, warning, error) use [Alert](Alert) | ||
| instead. |
There was a problem hiding this comment.
I would also add where it should be used. in the page flow? at the top?
| renderCloseButtonLabel="Close" | ||
| margin="0 0 general.spaceMd" | ||
| > | ||
| Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod |
There was a problem hiding this comment.
Can you ask design for some of the examples for a more realistic text, so its easier to understand what this should be used for?
| title="Banner header" | ||
| renderIcon={DiamondInstUIIcon} | ||
| renderCloseButtonLabel="Close" |
There was a problem hiding this comment.
please add here variants that do not render the close button and have no title
| const variants = ['relaxed', 'compact'] as const | ||
| return ( | ||
| <main className="flex gap-8 p-8 flex-col items-start axe-test"> | ||
| {variants.map((variant) => ( |
There was a problem hiding this comment.
its a bit overkill to do a loop for 2 variants..
Add new Banner component Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Both props hold plain text, so renderCloseButtonLabel becomes closeButtonLabel and no longer accepts a render function. Co-Authored-By: Claude <noreply@anthropic.com>
The attributes were set again before React removed the announcement node, so the region looked the same at removal as without the reset. The Canvas code it came from removes the node in between and was written for JAWS with Internet Explorer. Co-Authored-By: Claude <noreply@anthropic.com>
… text Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
d965f74 to
065c323
Compare
Summary
@instructure/ui-bannerpackage with a Banner v1 component@instructure/ui/v11_7and the docs appTest Plan
Escapewith focus inside,open={false}from outside andtimeoutFixes INSTUI-5210
🤖 Generated with Claude Code