diff options
Diffstat (limited to 'src/components/FocusScope/index.web.tsx')
-rw-r--r-- | src/components/FocusScope/index.web.tsx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/components/FocusScope/index.web.tsx b/src/components/FocusScope/index.web.tsx new file mode 100644 index 000000000..43ea06a2d --- /dev/null +++ b/src/components/FocusScope/index.web.tsx @@ -0,0 +1,15 @@ +import {type ReactNode} from 'react' +import {FocusScope as RadixFocusScope} from 'radix-ui/internal' + +/* + * The web version of the FocusScope component is a proper implementation, we + * use this in Dialogs and such already. It's here as a convenient counterpart + * to the hacky native solution. + */ +export function FocusScope({children}: {children: ReactNode}) { + return ( + <RadixFocusScope.FocusScope loop asChild trapped> + {children} + </RadixFocusScope.FocusScope> + ) +} |