react-laag
react-laag copied to clipboard
auto prop not acting as expected
Take the following config:
useLayer({
placement: 'right-center',
possiblePlacements: [
'right-center',
'left-center',
'bottom-center',
'top-center',
],
auto: false,
})
Expected result:
Actual result:
The possiblePlacements
are only used when auto
is set to true. This does not make sense to me, also when reading the definition of auto
:
should we switch automatically to a placement that is more visible on the screen?
What I want to happen here is for useLayer
to find the best position when opening the layer, but not reposition it afterwards. This way, there is no possibility to do that, because you'd always need to set auto
to true.
Suggested change: make auto
only control repositioning of an open layer, and initial placement always take possiblePlacements
into account. If you'd not want any other positions to be selected, you just leave possiblePlacements
empty right?