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 {
1212} from 'components/Tooltip/TooltipTypes'
1313import { useTooltip } from 'components/TooltipProvider'
1414import { TooltipContent } from 'components/TooltipContent'
15+ import cssSupports from 'utils/css-supports'
1516import type { ITooltipController } from './TooltipControllerTypes'
1617
1718const TooltipController = ( {
@@ -274,15 +275,15 @@ const TooltipController = ({
274275 // eslint-disable-next-line no-console
275276 console . warn ( '[react-tooltip] Do not set `style.border`. Use `border` prop instead.' )
276277 }
277- if ( border && ! CSS . supports ( 'border' , `${ border } ` ) ) {
278+ if ( border && ! cssSupports ( 'border' , `${ border } ` ) ) {
278279 // eslint-disable-next-line no-console
279280 console . warn ( `[react-tooltip] "${ border } " is not a valid \`border\`.` )
280281 }
281282 if ( style ?. opacity ) {
282283 // eslint-disable-next-line no-console
283284 console . warn ( '[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead.' )
284285 }
285- if ( opacity && ! CSS . supports ( 'opacity' , `${ opacity } ` ) ) {
286+ if ( opacity && ! cssSupports ( 'opacity' , `${ opacity } ` ) ) {
286287 // eslint-disable-next-line no-console
287288 console . warn ( `[react-tooltip] "${ opacity } " is not a valid \`opacity\`.` )
288289 }
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