With the refactor of Popover to using floating-ui internally (#40740), a new placement prop was introduced with the objective of replacing the legacy position prop.
Currently, there is a function converting position to placement, but:
- its logic is complicated and difficult to follow
- its logic could potentially miss some edge cases:
- it looks like
position accepted the undocumented format [yAxis] [xAxis] [corner])
- it looks like the new
placement prop doesn't allow the Popover to be placed centered on top of its anchor
- its logic is not covered by unit tests (which makes the previous checks necessary)
Therefore, to improve the situation and get ready to deprecate the position prop, we should:
- Assess that all possible values of
position are converted correctly (or in a best-effort way) to the corresponding placement
- Write unit tests
- Potentially make changes to the conversion logic to respect the tests added from the previous point
With the refactor of
Popoverto usingfloating-uiinternally (#40740), a newplacementprop was introduced with the objective of replacing the legacypositionprop.Currently, there is a function converting
positiontoplacement, but:positionaccepted the undocumented format[yAxis] [xAxis] [corner])placementprop doesn't allow thePopoverto be placed centered on top of its anchorTherefore, to improve the situation and get ready to deprecate the
positionprop, we should:positionare converted correctly (or in a best-effort way) to the correspondingplacement