docs/react-v9/contributing/rfcs/react-components/convergence/popper-js.md
@ling1726
This RFC proposes the introduction of the OSS library popper.js as the main positioning engine
for converged components that require this functionality. Current examples include Tooltip and Menu components.
Popper is an OSS library that powers the positioning of multiple known and commonly used UI libraries. The library is designed to function independent of the rendering framework (i.e. React). The library also is designed with a plugin -like API to encourage custom modification of any part of the positioning logic used. Sane default behaviour is used that covers a large number of positioning use-cases such as:
v0 currently wraps popper.js into components that require out of order positioning in the DOM. v7 uses the Callout component to support positioning behaviour.
Popper is also used by the following OSS UI libraries in industry:
Positioning is a hard problem to solve. Pure CSS solutions are not powerful enough in modern applications since they have accessibility and usability problems:
Therefore, most solutions are writting in complex javascript that requires handling of all the boundary and scroll cases at runtime. This results in very complicated code, that needs to be actively maintained and improved. Looking at the current v7 documentation of Callout, there are more than 20 issues that stretch back to 2018 that still have not been resolved.
Popper references and supports the following selection of v8 open issues (following the thread discussions):
Convergence is moving fast, spending time to build a fully-fledged positioning library that handles all the boundary cases can be time consuming and slow down or block development for some components
The important part of this RFC is to get quorum on using popper in Fluent. This will allow us to offload the heavy effort of managing out of order DOM popoverse and focus on delivering value to our partners through usable components.
As mentioned above, out of the box popper provides support and configuration for the following scenarios:
In the short/long-term future, it is always possible for the team to reevaluate the scenarios supported by popper to see if the the library needs to be extended through popper modifiers or a custom solution, if there is a need for it based on feedback from our partners.
This RFC does not specify exactly how popper should be integrated into fluent, and is left to a technical discussion or follow up RFC. Since Popper is independent of any rendering framework (i.e. React), multiple integrations can be proposed and we can choose the one best suited for Fluent.
How the library is used can therefore be seen as a technical detail. It can be possible to use popper as an external component or hook or JS helper function. Lazy loading of the code module is also possible.