File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
components/TooltipController Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import type {
12
12
} from 'components/Tooltip/TooltipTypes'
13
13
import { useTooltip } from 'components/TooltipProvider'
14
14
import { TooltipContent } from 'components/TooltipContent'
15
+ import cssSupports from 'utils/css-supports'
15
16
import type { ITooltipController } from './TooltipControllerTypes'
16
17
17
18
const TooltipController = ( {
@@ -274,15 +275,15 @@ const TooltipController = ({
274
275
// eslint-disable-next-line no-console
275
276
console . warn ( '[react-tooltip] Do not set `style.border`. Use `border` prop instead.' )
276
277
}
277
- if ( border && ! CSS . supports ( 'border' , `${ border } ` ) ) {
278
+ if ( border && ! cssSupports ( 'border' , `${ border } ` ) ) {
278
279
// eslint-disable-next-line no-console
279
280
console . warn ( `[react-tooltip] "${ border } " is not a valid \`border\`.` )
280
281
}
281
282
if ( style ?. opacity ) {
282
283
// eslint-disable-next-line no-console
283
284
console . warn ( '[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead.' )
284
285
}
285
- if ( opacity && ! CSS . supports ( 'opacity' , `${ opacity } ` ) ) {
286
+ if ( opacity && ! cssSupports ( 'opacity' , `${ opacity } ` ) ) {
286
287
// eslint-disable-next-line no-console
287
288
console . warn ( `[react-tooltip] "${ opacity } " is not a valid \`opacity\`.` )
288
289
}
Original file line number Diff line number Diff line change
1
+ const cssSupports = ( property : string , value : string ) : boolean => {
2
+ const hasCssSupports = 'CSS' in window && 'supports' in window . CSS
3
+ if ( ! hasCssSupports ) {
4
+ return true
5
+ }
6
+ return window . CSS . supports ( property , value )
7
+ }
8
+
9
+ export default cssSupports
You can’t perform that action at this time.
0 commit comments