I have a Box and upon clicking it, I open a popper that has some inputs. I am using ref and anchorEl to position the popper. All is working fine in this case. Popper opens up in the default bottom position of the ref element.
But in order to use accessibility feature and tab through box to input, I had to set disablePortal={true} so that Tab on the Box will focus on the inputs on the corresponding Popper. But after adding disablePortal={true} the positioning is not working properly. I want to use default bottom, but it doesn't respects the position being provided at all.
Initialising ref for positioning element
const dropdownRef = useRef(null)
JSX Code is given below:
<Box onClick={showPopper} tabIndex={0}>
<Box ref={dropdownRef}>
Random Content
</Box>
<Popper
disablePortal={true}
open={isActive}
anchorEl={dropdownRef?.current ?? null}
transition
placement="bottom"
>
<Checkbox tabIndex={0} />
</Popper>
</Box>
Note: I could adjust placement by using style properties like left and top. But thats not a good way since Popper adjust its position also based on available window space, so it's not a good idea. I want that feature to be working as well.