react-focus-trap
react-focus-trap copied to clipboard
Forward all properties.
It's a good rule of thumb to forward all unrecognized properties that were passed down.
Which part of the component should we forward unrecognized props to? This is the structure of a focus trap:
<div class="focus-trap-wrapper">
<div class="focus-trap-backdrop" />
<div class="focus-trap">
{children}
</div>
</div>
Ignoring the backdrop, should unrecognized props be forwarded to focus-trap-wrapper
, or focus-trap
?
That's a good question. I guess it depends. I usually pass them to the top level container. It's worth to mention, though, that it might not be the perfect solution in all cases.