New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popper.js v2 #617
Comments
Commenting here to follow progress. Exciting stuff! |
Do we really need set Why we can't return And we need set return types there — |
I don't think it's useful to return |
I think if we expected |
It's common practice to return a null value if it's not possible to return the expected type 🤷♂️ Better than letting think the user that everything is fine and it actually isn't. |
Hm, yes, I agree. But I would say that depends on the situation. Anyway, I will try to help with PR. |
Just to share a bit of updates on the status of the Right now there aren't any modifiers included, if you open the We need to add support for all the logic that handles the possible different contexts a popper may live in (scrolling parent, overflow hidden etc). I really want to reach the point where we'll have a rock solid core positioning logic, independent by any additional modifier. So that we can confidently write additional code (modifiers) on top of it and never worry to have wrong results from the core computations. Also, secret wish, make PopperJS compatible with react-native 🤭Ideally if we keep a good separation between DOM utilities and the rest, we should be able to write react-native specific utilities to replace the DOM ones. And reuse all the rest of the library |
Will it be possible to import separate methods from popper? like get scroll parent, get position etc.? Sometimes there's a need of such when dealing with manual implementations, so this would be super awesome not having to write/copy the logic again. Just a wish :) Edit: nvm, I see it does separate exports :) |
Sorry for the lack of updates, life been busy recently. I just finished to update the branch to work with the latest version of the dependencies (babel, jest etc). I just published the As I mentioned earlier, right now there aren't any modifiers included, not even the new Popper(
reference,
popper,
{
placement: 'right',
modifiers: [
{
name: 'applyStyle',
phase: 'write',
enabled: true,
fn(state) {
console.log(state);
popper.style.top = `${state.offsets.popper.y}px`;
popper.style.left = `${state.offsets.popper.x}px`;
return state;
}
}
]
}
); |
I published 2.0.0-next.3 It finally ships with some modifiers (computeStyles and applyStyles), so you can now use it without any additional configuration required. If anyone wants to write additional modifiers please do so, it'd be super helpful! For now, we got a completely type safe code base, easy to understand (I hope) and which once minified weights as little as 2.42 kB! |
2.0.0-next.4 is here, the positioning algorithm is now more solid, it'd be helpful if you guys sent PRs to add more visual test cases (failing or not) so that I can improve the algorithm to address them or avoid to break them while I work on it. |
2.42 kB is insane, great work!! |
Thanks, now the next challenge is to write the |
What's the current state of react-native compatibility? |
I haven't yet experimented with it. Developement of v2 is going slowly unfortunately. |
Will you be getting some time to work on this or is it postponed indefinitely for now? 🥺 |
The prevent overflow modifier is yet to be written, it's the most important piece still missing. For some reason I can't figure out how to write it |
Maybe you can do a 2.0 release that fixes the common current API painpoints, and schedule a complete rewrite (considering it seems very difficult) for a minor release? Basically, try to restructure the code in a way that allows for a better/smaller architecture in the future without completely throwing out the existing code, assuming that is possible. Dev + prod versions without the warning messages in production would also cut down on some of the existing size to help justify it a bit. |
I don't have bandwidth to work on the current code base, and it's so messy that I fear I'd break something. 😔 |
@FezVrasta out of interest will v2 be treeshakeable? I remember the humble days of old versions where Popper was more lightweight but now as you mention it's turned into almost a full blown framework. It would be awesome to be able to just import the basic functionality that you need if you just want the bare basics to position a tooltip around an element. |
It will be treeshakeable 👌 |
If anyone is interested in helping me out with the prevent overflow logic, I created a PR to show the progress. Any help is very appreciated. |
Yeah it still comes up with the config folder error without any options or |
We're pretty much finished now btw – auto placements was the last feature to add and is now merged. 🕒 |
Just updated to alpha.4 and now I am getting this |
So is the |
The |
Then it's somewhere hidden?
|
The |
Ohhh, totally my bad, did not notice it's alpha, not next. |
Does Edge work with For fixed elements you should use |
No, doesn't seem like it, still incorrect placement, |
What is |
They both (popper and reference) contain 1 entry - Window (on chrome and on edge). /lib/dom-utils/getCompositeRect.js
on Edge the |
Heres what they return when scrolled 100px
Edge:
as in:
|
So |
If only Edge dev tools weren't so atrocious to debug in 😂 |
So |
So it only happens when |
Not sure if this is related or not, but In particular, I think https://github.com/popperjs/popper.js/blob/48334d01dfe496333a2dae5cced89dc1c38c3840/src/dom-utils/getWindow.js#L6 is not correct since if It's not 100% clear to me why we need to check for |
I use the presence of |
@FezVrasta is it possible to do |
The problem is that |
What's wrong with the v1 function? function getWindow(element) {
const ownerDocument = element.ownerDocument;
return ownerDocument ? ownerDocument.defaultView : window;
} I'm guessing if Not sure how to workaround // @flow
export default function getWindow(node: Node): any {
if ({}.toString.call(node) !== '[object Window]') {
const ownerDocument = node.ownerDocument;
return ownerDocument ? ownerDocument.defaultView : window;
}
return node;
} |
In Flow “window” is typed as “any” so I think you could return “Window” there |
Hey everybody! I just finished to switch popper.js.org to the v2 website. I also published the first release candidate ( Popper 2 is now on the |
I'm going to close this issue, feel free to post here if you want to talk about the release. For anything else, please open a new issue! |
If anyone wants to contribute to the Popper.js v2 rewrite please do so sending PRs against the
next
branch.It's a completely new codebase, I think the current codebase is too messy to continue to work on it, it started as a little proof of concept and ended up being a full fledged library, I think it deserves a complete rewrite.
The idea is to copy the good code from the old version and write new one to make the new code more stable.
I'd like to make the library even more performant by better leveraging to an internal cache the modifiers can use to get most of the values they need that have been already read from the DOM.
The only decisions I made so far are:
To do:
BREAKING CHANGE
If you'd like to contribute please write here so others know who's working on what.
The text was updated successfully, but these errors were encountered: