-
Notifications
You must be signed in to change notification settings - Fork 282
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(clerk-js,types): Add option to disable portaling within UserButton and OrgSwitcher components #3837
Conversation
…on and OrgSwitcher components
🦋 Changeset detectedLatest commit: d80fd2b The changes in this PR will be included in the next version bump. This PR includes changesets to release 18 packages
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 |
const { floating, reference, styles, toggle, isOpen, nodeId, context } = usePopover({ | ||
defaultOpen, |
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.
Fix defaultOpen
usage.
Hey @alexcarpenter - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i [email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact |
"@clerk/clerk-js": patch | ||
"@clerk/types": patch |
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.
"@clerk/clerk-js": patch | |
"@clerk/types": patch | |
"@clerk/clerk-js": minor | |
"@clerk/types": minor |
We're adding new functionality, so we should use a minor version.
@@ -894,6 +894,11 @@ export type UserButtonProps = UserButtonProfileMode & { | |||
* Controls the default state of the UserButton | |||
*/ | |||
defaultOpen?: boolean; | |||
/** | |||
* By default, the popover will be rendered outside of the app root and into the body. | |||
* @default true |
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.
I'm not seeing where this is being defaulted to true
. Is that somewhere outside this PR? I tried to track it down, but our Context setup seems a bit complex 😵💫
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.
I had the same question, the existing code defines it so it's hard to see it in the PR. It is defined here
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.
LGTM, just a recommendation about naming
* By default, the popover will be rendered outside of the app root and into the body. | ||
* @default true | ||
*/ | ||
portal?: boolean; |
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.
🙃 maybe skipPortal
?
@@ -894,6 +894,11 @@ export type UserButtonProps = UserButtonProfileMode & { | |||
* Controls the default state of the UserButton | |||
*/ | |||
defaultOpen?: boolean; | |||
/** | |||
* By default, the popover will be rendered outside of the app root and into the body. | |||
* @default true |
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.
I had the same question, the existing code defines it so it's hard to see it in the PR. It is defined here
Closing for now, as we'd need to account for modals as well, which is a bit bigger of a lift that needs more consideration. |
Description
Allow disabling portal usage within both
<UserButton >
and<OrganizationSwitcher />
components to allow folks to make use of these components within dialog or sheet contexts.Screen.Recording.2024-07-29.at.1.29.28.PM.mov
https://linear.app/clerk/issue/SDKI-518/expose-portal-prop-to-userbutton-and-organizationswitcher-components
Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change