about summary refs log tree commit diff
path: root/src/components/FocusScope/index.web.tsx
blob: 43ea06a2df4f2ad7766ecca62c06c5606fed47e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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>
  )
}