Skip to content

Popover: assess all position to placement conversions, add unit tests #44339

@ciampo

Description

@ciampo

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:

  1. Assess that all possible values of position are converted correctly (or in a best-effort way) to the corresponding placement
  2. Write unit tests
  3. Potentially make changes to the conversion logic to respect the tests added from the previous point

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions