Repository navigation
Conversation
Co-authored-by: Fábio Neves <fabio.neves@clickhouse.com>
Co-authored-by: Fábio Neves <fabio.neves@clickhouse.com>
Co-authored-by: Fábio Neves <fabio.neves@clickhouse.com>
Co-authored-by: Fábio Neves <fabio.neves@clickhouse.com>
Co-authored-by: Fábio Neves <fabio.neves@clickhouse.com>
Co-authored-by: Fábio Neves <fabio.neves@clickhouse.com>
…g it Co-authored-by: Fábio Neves <fabio.neves@clickhouse.com>
🦋 Changeset detectedLatest commit: 68815ed The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
|
Storybook Preview Deployed✅ Preview URL: https://click-5whz76e7o-clickhouse.vercel.app Built from commit: |
Chromatic Storybook
Built from commit: Statuses as of the end of the run. The build link shows the live review state. |
Description
Alerttakes four new optional props. Long alert or error text can now be capped, so a long message no longer shifts the layout around it. This follow-up was agreed in #1277.maxHeight?: number | stringcaps the whole alert, toggle included. A number is px; a string is any CSS length ('12lh','100%'). When the text overflows, a Show more / Show less toggle appears.onExpandedChange?: (expanded: boolean) => voidfires when the user toggles. It only fires whenmaxHeightis set.expandLabel/collapseLabel(strings) default to'Show more'/'Show less'.WarningAlert,DangerAlert,InfoAlertandSuccessAlertpass the props through.Behaviour:
mask-image, which works on any background), and shows the toggle.maxHeight.keyto reset it.maxHeight, nothing changes. No new class, custom property, observer or DOM.Links and tickets
Good to know
expanded/defaultExpanded, a grow-to-full-height mode, and opening the text in a modal.AlertPropsdoesn't extendHTMLAttributes, and there is noforwardRef.useAlertOverflow, in the Alert folder. It is not exported, anduseIsTruncatedis untouched. Observers are created once per mount and not rebuilt on toggle.--click-container-space-smand--click-container-gap-xxs.-webkit-mask-imagesits besidemask-imageunder a scoped stylelint disable, because the browserslist targets include Chrome below 120 and the build has no autoprefixer.MaxHeightKeyboardstory: once expanded, the scroll region is one Shift+Tab back from the toggle, because the DOM order is title, text, toggle.eslint-suppressions.jsonis unchanged.Checklist
minor.maxHeightis set. All 40 existing Alert snapshots pass unchanged (no regenerations); 14 new snapshots cover the new stories.Contribution
buildandbuild-storybookwork locallyAccessibility
<button>(Enter / Space), and focus stays on it after both actions. While expanded and scrollable, the text area is focusable, so arrow keys scroll it. Tabbing onto a link inside clipped text expands the alert. Esc doesn't apply.aria-expandedandaria-controls. When a title exists, the scroll region isrole="region", named by the title.--click-global-color-outline-default. The fade is removed in forced-colors mode. The text toggle is under 24 px tall and relies on the WCAG 2.5.8 spacing exception (it sits alone on its row).WCAG 2.2 criteria checked: 1.4.3 Contrast (the toggle inherits the alert text colour), 2.1.1 Keyboard, 2.4.3 Focus Order, 2.4.7 Focus Visible, 2.5.3 Label in Name, 4.1.2 Name, Role, Value. In the Storybook Accessibility panel, axe shows no new violations on the new stories. The existing colour-contrast findings on info-state alerts also appear on the current
StateInfostory. Not tested with a real screen reader.Screenshots
Collapsed (light): fade and Show more.
Expanded (danger, dark): same height, the text scrolls, focus stays on Show less.
Note
Low Risk
Opt-in API with no default-path changes; risk is limited to consumers setting maxHeight and to observer/measurement edge cases, not auth or data handling.
Reviewed by Cursor Bugbot for commit 68815ed. Bugbot is set up for automated code reviews on this repo. Configure here.