twbs / bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
https://getbootstrap.com
MIT License
170.4k stars 78.81k forks source link

Upgrade from `@popperjs/core` to `floating-ui` #36497

Open benmccann opened 2 years ago

benmccann commented 2 years ago

Prerequisites

Proposal

Upgrade to floating-ui, which is the new version

Motivation and context

@popperjs/core is not compatible with server-side rendering (https://github.com/bestguy/sveltestrap/issues/463). floating-ui has fixed this issue by correctly setting the exports map in package.json

GeoSot commented 2 years ago

@benmccann do you think we can change the library without the cost of major changes in config object of toolitp, popover and dropdown?

benmccann commented 2 years ago

I'm not sure what changes would be required

mdo commented 2 years ago

I'm not sure what changes would be required

That's the primary concern for us, as @GeoSot mentions. We don't know how much work it'd be to replace this, and it'd likely be billed as a breaking change as we'd have a new dependency. That's not always the best for our end users. Without more information, we'll be left to figure it out when we can, which likely won't be until v6.

benmccann commented 2 years ago

They've now created a migration guide: https://floating-ui.com/docs/migration

Remzi1993 commented 1 year ago

They've now created a migration guide: https://floating-ui.com/docs/migration

I hope the Bootstrap team upgrades Popperjs. I would encourage everyone to upgrade as fast as possible to avoid any technical debt. Would be better if they just release it as version 6 or even better maybe not include it and make Bootstrap more modular, so devs can add it to Bootstrap like an add-on. Like without the add-on some things don't work and with you get extra features. This way you're not depended on updating the library yourself but the devs.

atomiks commented 1 year ago

From what I can see, Bootstrap doesn't expose any of Popper's API internals in a way that would prevent upgrading, which means it should be possible to keep it backwards-compatible. You can map the options to the new Floating UI ones with the same behavior after changing the dependency, and end-users wouldn't see any difference.

Cases where it'd break is non-bundled CDN usage where they reference bootstrap@5 (non-pinned) which automatically loads in new versions, and it then depends on Floating UI link instead; or they didn't have @popperjs/core installed but were using it indirectly anyway. I'm not sure if either of those should be covered by semver.

Upgrading should take less than an hour overall. Disclaimer: I am a maintainer of Floating UI. If you need help let me know!

Edit: Just realized I was on 4.0 docs accidentally, not 5.0. In v5, I can see there's a popperConfig object which complicates it quite a bit, although it's still possible to map the behavior but needs a middle layer to keep the API the same.

Remzi1993 commented 6 months ago

Is this being worked on? I would like to use the new Floating UI

julien-deramond commented 6 months ago

Is this being worked on? I would like to use the new Floating UI

This feature is planned for the v6 and the v6 development hasn't yet started.

Remzi1993 commented 6 months ago

Is this being worked on? I would like to use the new Floating UI

This feature is planned for the v6 and the v6 development hasn't yet started.

Thank you so much for your reply. Do you also know if this will be implemented in a modular way, so devs can update this library indepently from Bootstrap?

dakhnod commented 6 months ago

Is there any way to fix https://github.com/twbs/bootstrap/issues/39830 with popper?