Skip to content

Commit 4282bfa

Browse files
chore(clerk-js,types): Add drawer root descriptor (#5924)
1 parent df6fefd commit 4282bfa

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

.changeset/mighty-forks-joke.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
'@clerk/types': patch
4+
---
5+
6+
Add `drawerRoot` descriptor and adjust z-index approach.

packages/clerk-js/src/ui/customizables/elementDescriptors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export const APPEARANCE_KEYS = containsAllElementsConfigKeys([
106106
'dividerLine',
107107

108108
'drawerBackdrop',
109+
'drawerRoot',
109110
'drawerContent',
110111
'drawerHeader',
111112
'drawerTitle',

packages/clerk-js/src/ui/elements/Drawer.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,20 @@ const Content = React.forwardRef<HTMLDivElement, ContentProps>(({ children }, re
222222
outsideElementsInert
223223
initialFocus={refs.floating}
224224
>
225-
<div
225+
<Box
226226
ref={mergedRefs}
227227
{...getFloatingProps()}
228-
style={{
228+
sx={t => ({
229229
position: strategy,
230230
insetBlock: 0,
231231
insetInline: 0,
232232
pointerEvents: 'none',
233-
}}
233+
isolation: 'isolate',
234+
// When drawer is within the profile components, we need to ensure it is above the drawer
235+
// renders above the profile close button
236+
zIndex: strategy === 'absolute' ? t.zIndices.$modal : undefined,
237+
})}
238+
elementDescriptor={descriptors.drawerRoot}
234239
>
235240
<Flex
236241
elementDescriptor={descriptors.drawerContent}
@@ -260,13 +265,12 @@ const Content = React.forwardRef<HTMLDivElement, ContentProps>(({ children }, re
260265
borderColor: t.colors.$neutralAlpha100,
261266
boxShadow: t.shadows.$cardBoxShadow,
262267
overflow: 'hidden',
263-
zIndex: t.zIndices.$modal,
264268
pointerEvents: 'auto',
265269
})}
266270
>
267271
{children}
268272
</Flex>
269-
</div>
273+
</Box>
270274
</FloatingFocusManager>
271275
);
272276
});

packages/clerk-js/src/ui/elements/Switch.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const Switch = forwardRef<HTMLDivElement, SwitchProps>(
3434
align='center'
3535
as='label'
3636
sx={t => ({
37+
isolation: 'isolate',
3738
width: 'fit-content',
3839
'&:has(input:focus-visible) > input + span': {
3940
...common.focusRingStyles(t),

packages/types/src/appearance.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ export type ElementsConfig = {
225225
dividerLine: WithOptions;
226226

227227
drawerBackdrop: WithOptions;
228+
drawerRoot: WithOptions;
228229
drawerContent: WithOptions;
229230
drawerHeader: WithOptions;
230231
drawerTitle: WithOptions;

0 commit comments

Comments
 (0)