-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add isInitiallyOpen option to modal #1971
Merged
Merged
Conversation
This file contains 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
hgarfinkle
requested review from
suzubara,
gidjin,
haworku,
ahobson,
brandonlenz and
SirenaBorracha
as code owners
April 7, 2022 22:23
Should the prop have a different name? Such as |
hgarfinkle
changed the title
add isInitiallyOpen option to modal
feat: add isInitiallyOpen option to modal
Apr 7, 2022
brandonlenz
reviewed
Apr 11, 2022
src/components/Modal/utils.ts
Outdated
Comment on lines
18
to
23
// Element is a close button - proceed | ||
// Don't allow opening a modal from within a modal | ||
return ( | ||
clickedElement.hasAttribute('[data-close-modal]') || | ||
clickedElement.closest('[data-close-modal]') | ||
) { | ||
// Element is a close button - proceed | ||
return true | ||
} else { | ||
// Don't allow opening a modal from within a modal | ||
return false | ||
} | ||
!!clickedElement.closest('[data-close-modal]') | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Might want to update the comment to go with it. maybe Only allow toggle if element is a close button
brandonlenz
approved these changes
Apr 21, 2022
hgarfinkle
added
the
type: automerge
PR will be merged automatically i.e., by a bot or action
label
Apr 21, 2022
Merged
brandonlenz
added a commit
that referenced
this pull request
Apr 25, 2022
## [3.0.0](2.9.0...3.0.0) (2022-04-25) ### ⚠ BREAKING CHANGES * Previous deprecated features and props have been removed. Please see the following guidance for affected components: * Accordion: Default heading level has been removed. Consumers must now specify via the `headingLevel` prop. * Alert: Default heading level has been removed. Consumers must now specify via the `headingLevel` prop. * Button: * `accent` has been removed. Use `accentStyle` instead. * `big`, `small`, and `size="small"` have been removed. Use `size="big"` or do not define the `size` prop for default sizing. * CollectionHeading: Default heading level has been removed. Consumers must now specify via the `headingLevel` prop. * Footer/Address: `big`, `medium`, and `slim` props have been removed. Use the `size` prop instead. * Footer/Footer: `big`, `medium`, and `slim` props have been removed. Use the `size` prop instead. * Footer/FooterNav: `big`, `medium`, and `small` props have been removed. Use the `size` prop instead. * Footer/Logo: `big`, `medium`, and `small` props have been removed. Use the `size` prop instead. * Search: `big`, and `small` props have been removed. Use the `size` prop instead. * Fieldset: `legendSrOnly` has been removed. Use `legendStyle="srOnly"` instead. * TextInput: `error`, and `success` props have been removed. Use the `validationStatus` prop instead. * header/NavList: `primary`, `secondary`, `subnav`, `megamenu`, and `footerSecondary` props have been removed. Use the `type` prop instead. * StepIndicator: Default heading level has been removed. Consumers must now specify via the `headingLevel` prop. * SummaryBox now exposes sub-components (SummaryBoxHeading and SummaryBoxContent) for a more compositional API. Consumers will need to update their implementation to match. * In order to accommodate IconList as a named component, Icons themselves needed to be refactored. All use of ReactUSWDS icons now follows the following syntax: <Icon.{IconName} /> instead of <Icon{IconName />. Furthermore, icons are no longer imported individually. Instead, Icon (the class) is imported to then use any <Icon.{IconName}> consumers require. ### Features * add isInitiallyOpen option to modal ([#1971](#1971)) ([560564e](560564e)) * Make Summary Box more flexible ([#1929](#1929)) ([a46ed35](a46ed35)) * New Component: IconList ([#1691](#1691)) ([86589ac](86589ac)) * **ci:** add automerge priority label for Kodiak ([#1985](#1985)) ([9dc940e](9dc940e)) * Remove 1.x.x and 2.x.x deprecated properties ([#1988](#1988)) ([5dfadb1](5dfadb1)) ### Documentation & Examples * 404 page template added ([#2017](#2017)) ([0c9474d](0c9474d))
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.
Summary
Adds an optional prop to Modal component,
isInitiallyOpen
, which controls whether the Modal is by default open on mount.Related Issues or PRs
closes #1897
How To Test
View the storybook story "Initially open modal"
Screenshots (optional)