Skip to content

Commit 8027fd3

Browse files
committed
Fix css capture for portals in range datepickers
1 parent 0a61954 commit 8027fd3

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

components/dash-core-components/src/fragments/DatePickerRange.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ const DatePickerRange = ({
110110
// Capture CSS variables for portal mode
111111
const portalStyle = useMemo(() => {
112112
return hasPortal ? captureCSSForPortal(containerRef) : undefined;
113-
}, [hasPortal]);
113+
}, [hasPortal, isCalendarOpen]);
114114

115115
useEffect(() => {
116116
setInternalStartDate(strAsDate(start_date));

components/dash-core-components/src/utils/calendar/cssVariables.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ export function captureCSSForPortal(
2525
}
2626

2727
// Capture key inherited properties
28-
const inheritedProps = ['fontFamily', 'fontSize', 'color'];
28+
const inheritedProps = ['font-family', 'font-size', 'color'];
2929
inheritedProps.forEach(prop => {
3030
const value = computedStyle.getPropertyValue(prop);
3131
if (value) {
32-
styles[prop] = value;
32+
// Convert hyphenated CSS property names to camelCase for React
33+
const camelCaseProp = prop.replace(/-([a-z])/g, (_, letter) =>
34+
letter.toUpperCase()
35+
);
36+
styles[camelCaseProp] = value;
3337
}
3438
});
3539

0 commit comments

Comments
 (0)