feat(form): add new disableStickyOnSmallScreen prop - FE-7686#8005
Draft
DipperTheDan wants to merge 1 commit into
Draft
feat(form): add new disableStickyOnSmallScreen prop - FE-7686#8005DipperTheDan wants to merge 1 commit into
DipperTheDan wants to merge 1 commit into
Conversation
Ensures that disableStickyOnSmallScreen can work with Form inside of a Dialog with the same prop applied. fix #7973
6a1fbde to
ff7ec53
Compare
There was a problem hiding this comment.
Pull request overview
Adds a disableStickyOnSmallScreen prop to the Form component so consumers can opt out of the sticky footer behaviour on small screens (to align with Dialog’s small-screen accessibility behaviour when a Form is used inside a Dialog).
Changes:
- Introduces
disableStickyOnSmallScreen?: booleanonFormPropsand wires it intoStyledFormFooter. - Adds responsive styling to unstick the Form footer (position/box-shadow) at
max-width: 600px. - Updates the Dialog “Small Screen Behavior” Storybook example and adds a unit test for the new styling branch (plus regenerated skills docs).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/form/form.component.tsx | Adds the new disableStickyOnSmallScreen prop to FormProps and passes it to the footer styling. |
| src/components/form/form.style.ts | Implements the small-screen media query that disables sticky footer styles when the prop is enabled. |
| src/components/form/form.test.tsx | Adds a styled-components media-query assertion to cover the new styling branch. |
| src/components/dialog/dialog.stories.tsx | Updates the small-screen behavior example to demonstrate a Form using the new prop within a Dialog. |
| skills/carbon-react/components/form.md | Regenerated skills/docs to include the new Form prop. |
| skills/carbon-react/components/dialog.md | Regenerated skills/docs reflecting the updated story example. |
Comment on lines
+307
to
+308
| // for coverage - the `disableStickyOnSmallScreen` prop is captured by Chromatic. | ||
| test("disables sticky footer unconditionally when `disableStickyOnSmallScreen` and `stickyFooter` are set", () => { |
Comment on lines
+643
to
+645
| This improves accessibility on mobile devices. We also have a | ||
| `disableStickyOnSmallScreen` prop that means Form can also be used | ||
| within a Dialog without a sticky footer on small screen devices. |
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.
Ensures that disableStickyOnSmallScreen can work with Form inside of a Dialog with the same prop applied.
fix #7973
Proposed behaviour
Adds a new prop to Form called
disableStickyOnSmallScreenthat can be used in conjunction with Dialog's prop of the same name to allow Form's to be used in Dialog on a small screen and have the same styling applied.Current behaviour
disableStickyOnSmallScreenonly exists in Dialog so can hinder the flow of Forms in a Dialog.Checklist
d.tsfile added or updated if requiredQA
Additional context
Testing instructions
small-screen-behaviorexample now includes Form with thedisableStickyOnSmallScreenprop. Above 600px the footer should be sticky and below 600px the footer should not be sticky.