Skip to content
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

PopupMenu keeps changing position - default position isn't deterministic #384

Closed
whiskeyPeak opened this issue Nov 15, 2022 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@whiskeyPeak
Copy link
Contributor

whiskeyPeak commented Nov 15, 2022

I tried out the web demo for the Yaru widget library and found that the PopupButton seems to act a little weird sometimes.

For the first of the 3 buttons in the example, the popup options come out below the popup button albeit not completely. When the value is changed to option 2 or 3, the popup options are displayed over the popup button. I don't know if this is intended behaviour but I personally think the behaviour should be constant.

For the next 2 buttons, the popup options are correctly under the popup button but one is aligned to the left whilst the other is displayed to the right. Is this intended behaviour?

Video of the behaviour for each button:

simplescreenrecorder-2022-11-15_02.27.07.mp4
@jpnurmi
Copy link
Member

jpnurmi commented Nov 15, 2022

I'm not sure if the different choice was intentional but unlike the Material style PopupMenuButton that sets PopupMenuPosition.over by default, YaruPopupMenuButton specifies the position as PopupMenuPosition.under. Notice that this does not mean that the entire menu gets positioned under the button, but that the selected menu item is anchored right below the respective button item. Also, given that the popup menu is not a top-level window, it has to be pushed down to keep it within the window when selecting the last options.

@Feichtmeier
Copy link
Member

not intentional, I thought under means under the button :)

@Feichtmeier
Copy link
Member

with under and offset it works fine for the multi and checked ones
grafik
grafik

but not when using normal material PopupMenuItem
grafik

@whiskeyPeak
Copy link
Contributor Author

I checked this again with the latest from main and the issue is still reproducible. I'll give this a look tomorrow.

@whiskeyPeak
Copy link
Contributor Author

Did some further digging and found that getting rid of the initialValue field makes the first popupMenuButton behave like the other 2. We probably still want to set an initial value so this is most likely a bug with how flutter does its layout for the PopupMenuItem widget.

simplescreenrecorder-2022-11-16_04.19.19.mp4

@Feichtmeier
Copy link
Member

Did some further digging and found that getting rid of the initialValue field makes the first popupMenuButton behave like the other 2. We probably still want to set an initial value so this is most likely a bug with how flutter does its layout for the PopupMenuItem widget.
simplescreenrecorder-2022-11-16_04.19.19.mp4

Ah! Weird! Well, yeah we can not get rid of this in general :S So I guess we either fix this in flutter (haha) or live with it?

@whiskeyPeak
Copy link
Contributor Author

whiskeyPeak commented Nov 17, 2022

Opened up an issue at flutter/flutter#115509 with a linked PR that fixes the general PopupMenuButton misalignment. It's still doesn't perfectly fix our issue here, but I suspect that is because a MenuItem has a slightly different height from a YaruMenuItem.

or live with it?

It's been bugging me too much haha 😅

@Jupi007 Jupi007 added the bug Something isn't working label Nov 20, 2022
Feichtmeier added a commit that referenced this issue Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants