Skip to content

Commit b41aae0

Browse files
authored
[scroll area] Fix CSS vars inheritance on Safari (#3208)
1 parent d894615 commit b41aae0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/react/src/scroll-area/viewport/ScrollAreaViewport.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as React from 'react';
33
import * as ReactDOM from 'react-dom';
44
import { useStableCallback } from '@base-ui-components/utils/useStableCallback';
55
import { useIsoLayoutEffect } from '@base-ui-components/utils/useIsoLayoutEffect';
6+
import { isWebKit } from '@base-ui-components/utils/detectBrowser';
67
import { useTimeout } from '@base-ui-components/utils/useTimeout';
78
import type { BaseUIComponentProps } from '../../utils/types';
89
import { useScrollAreaRootContext } from '../root/ScrollAreaRootContext';
@@ -31,7 +32,12 @@ let scrollAreaOverflowVarsRegistered = false;
3132
* under the "Improving CSS variable performance" section.
3233
*/
3334
function removeCSSVariableInheritance() {
34-
if (scrollAreaOverflowVarsRegistered) {
35+
if (
36+
scrollAreaOverflowVarsRegistered ||
37+
// When `inherits: false`, specifying `inherit` on child elements doesn't work
38+
// in Safari. To let CSS features work correctly, this optimization must be skipped.
39+
isWebKit
40+
) {
3541
return;
3642
}
3743

0 commit comments

Comments
 (0)