Skip to content

Commit 21d8a31

Browse files
authored
fix(Disclosure): content visibility style (#908)
1 parent 9fd69a2 commit 21d8a31

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.changeset/tasty-drinks-invent.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix content visibility in Disclosure.

src/components/actions/ItemButton/ItemButton.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ const ItemButton = forwardRef(function ItemButton(
100100
type = 'neutral',
101101
theme,
102102
onPress,
103+
// Extract react-aria press callbacks to prevent them from leaking to DOM via rest.
104+
// These are handled by useButton inside useAction.
105+
onPressStart: _onPressStart,
106+
onPressEnd: _onPressEnd,
107+
onPressChange: _onPressChange,
108+
onPressUp: _onPressUp,
103109
actions,
104110
size = 'medium',
105111
wrapperStyles,

src/components/content/Disclosure/Disclosure.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export interface CubeDisclosureProps
8080
}
8181

8282
export interface CubeDisclosureTriggerProps
83-
extends Omit<CubeItemButtonProps, 'onPress'> {
83+
extends Omit<CubeItemButtonProps, 'onPress' | 'isDisabled'> {
8484
/** Children content for the trigger */
8585
children?: ReactNode;
8686
}
@@ -184,13 +184,14 @@ const ContentWrapperElement = tasty({
184184
'': '0',
185185
shown: 'max-content',
186186
},
187-
transition: 'height $disclosure-transition linear',
187+
transition: 'height $disclosure-transition',
188188
},
189189
});
190190

191191
const ContentElement = tasty({
192192
qa: 'DisclosureContent',
193193
styles: {
194+
contentVisibility: 'auto',
194195
padding: '1x',
195196
},
196197
});

src/components/helpers/DisplayTransition/DisplayTransition.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,8 @@ export function DisplayTransition({
327327
const refCallback: RefCallback<HTMLElement> = (node) => {
328328
if (node) {
329329
elementRef.current = node;
330-
331-
if (phaseRef.current === 'enter') {
332-
ensureEnterFlow();
333-
}
330+
// Don't call ensureEnterFlow() here - useLayoutEffect handles RAF scheduling
331+
// to ensure symmetric timing with exit flow
334332
} else {
335333
cleanupEventListeners();
336334
elementRef.current = null;

0 commit comments

Comments
 (0)