#Issue Using use-ref-within correctly

1 messages · Page 1 of 1 (latest)

dark moss
#

For some reason when I click on any of my child components (DropDownOption) use-ref-within returns false but it was my understanding that it should detect focus state on any child component within the Stack. Can someone please help me to understand why this is happening?

keen coyote
dark moss
#

my bad I meant

#

usefocuswithin

keen coyote
# dark moss https://mantine.dev/hooks/use-focus-within/

It returns whether any element that is inside given element has focus, make sure that you are not rendering your dropdown in portal, and that all elements are focusable (button, a or input). Note that Safari by default does not treat button as focusable element.