Skip to content

chore(clerk-js,types): Add drawer root descriptor #5924

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

Merged
merged 6 commits into from
May 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/mighty-forks-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': patch
'@clerk/types': patch
---

Add `drawerRoot` descriptor and adjust z-index approach.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export const APPEARANCE_KEYS = containsAllElementsConfigKeys([
'dividerLine',

'drawerBackdrop',
'drawerRoot',
'drawerContent',
'drawerHeader',
'drawerTitle',
Expand Down
14 changes: 9 additions & 5 deletions packages/clerk-js/src/ui/elements/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,20 @@ const Content = React.forwardRef<HTMLDivElement, ContentProps>(({ children }, re
outsideElementsInert
initialFocus={refs.floating}
>
<div
<Box
ref={mergedRefs}
{...getFloatingProps()}
style={{
sx={t => ({
position: strategy,
insetBlock: 0,
insetInline: 0,
pointerEvents: 'none',
}}
isolation: 'isolate',
// When drawer is within the profile components, we need to ensure it is above the drawer
// renders above the profile close button
zIndex: strategy === 'absolute' ? t.zIndices.$modal : undefined,
})}
elementDescriptor={descriptors.drawerRoot}
>
<Flex
elementDescriptor={descriptors.drawerContent}
Expand Down Expand Up @@ -260,13 +265,12 @@ const Content = React.forwardRef<HTMLDivElement, ContentProps>(({ children }, re
borderColor: t.colors.$neutralAlpha100,
boxShadow: t.shadows.$cardBoxShadow,
overflow: 'hidden',
zIndex: t.zIndices.$modal,
pointerEvents: 'auto',
})}
>
{children}
</Flex>
</div>
</Box>
</FloatingFocusManager>
);
});
Expand Down
1 change: 1 addition & 0 deletions packages/clerk-js/src/ui/elements/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const Switch = forwardRef<HTMLDivElement, SwitchProps>(
align='center'
as='label'
sx={t => ({
isolation: 'isolate',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preventing the switch thumb from rendering above the drawer content.

width: 'fit-content',
'&:has(input:focus-visible) > input + span': {
...common.focusRingStyles(t),
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/appearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export type ElementsConfig = {
dividerLine: WithOptions;

drawerBackdrop: WithOptions;
drawerRoot: WithOptions;
drawerContent: WithOptions;
drawerHeader: WithOptions;
drawerTitle: WithOptions;
Expand Down