Skip to content

Conversation

@Venefilyn
Copy link
Member

@Venefilyn Venefilyn commented Sep 8, 2025

For Patternfly's dropdown it uses PopperJS v2 under the hood, however it
does not work well within iframes with super small sizes where there is no
room to show the whole dropdown. Fixing this temporarily by making the
dropdown increase the page main sections height so that the dropdown
elements can all be accessed by scrolling.

Note, once a PF update is released with the PopperJS offset prop being
exposed we can use a better solution that relies on setting our own
offset.

How the fix looks in action:

Kooha-2025-09-03-16-23-53.webm

el.querySelector returns null if the query is valid and no elements were found:
https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector#return_value

Related-to: patternfly/patternfly-react#11987
Related-to: #22381
Signed-off-by: Freya Gustavsson [email protected]

@Venefilyn Venefilyn added the release-blocker Targetted for next release label Sep 8, 2025
@Venefilyn
Copy link
Member Author

@bruno-fs
Copy link
Contributor

bruno-fs commented Sep 8, 2025

Tested on anaconda mode and it works as well!

For Patternfly's dropdown it uses PopperJS v2 under the hood, however it
does not work well within iframes with super small sizes where there is no
room to show the whole dropdown. Fixing this temporarily by making the
dropdown increase the page main sections height so that the dropdown
elements can all be accessed by scrolling.

Note, once a PF update is released with the PopperJS offset prop being
exposed we can use a better solution that relies on setting our own
offset.

Related-to: patternfly/patternfly-react#11987
Related-to: cockpit-project#22381
Signed-off-by: Freya Gustavsson <[email protected]>
@Venefilyn
Copy link
Member Author

I'm on PTO tomorrow, Tuesday. Tests stopped working due to distrobox/toolbox usage and the image /tmp issue thing that is supposed to be fixed.

@mvollmer or @martinpitt can you take a look tomorrow why the tests fail? I suspect it to be related to test/common/storagelib.py#StorageHelpers.dropdown_action() having a selector that no longer works as the dropdown location was moved

https://logs-cockpit.apps.ocp.cloud.ci.centos.org/pull-22413-72fbe34e-20250908-163930-fedora-42-storage/log.html
https://logs-cockpit.apps.ocp.cloud.ci.centos.org/pull-22413-72fbe34e-20250908-163932-fedora-42-devel/log.html

@martinpitt
Copy link
Member

The screenshot shows that

    self.click_dropdown(self.card_row("Storage", location=subvol_mount_point), "Unmount")

didn't work, i.e. there's no dropdown.

That test works fine locally, both with firefox and chromium, and also with TEST_SHOW_BROWSER=1 and noninteractive. Trying to run it exactly like in CI:

test/common/run-tests --test-dir test/verify TestStorageUsed.testUsed TestStoragePartitions.testResize TestStorageMountingLUKS.testNeverAuto TestStorageMounting.testBadOption TestStorageLvm2.testUnpartitionedSpace TestStorageLvm2.testLvm TestStorageBtrfs.testMultiDevice

and that finally fails. So there's some "pollution" going on by previous tests. Bisect, rinse, repeat finally gives

test/verify/check-storage-lvm2 TestStorageLvm2.testLvm{,OnLuks} $RUNC
test/verify/check-storage-btrfs TestStorageBtrfs.testMultiDevice -stv $RUNC

After the initial two LVM tests, the testMultiDevice failure is stable. The firefox failure is also revealing:

testlib.Error: move target out of bounds: Move target (1515, 1205) is out of bounds of viewport dimensions (1680, 1131)

So it feels like the popup really isn't visible at the place of the dropdown. This even reproduces with TEST_SHOW_BROWSER=1 -- a mere click has either no effect, or the popup happens way outside the viewport area. Scrolling the page a little makes it jump to the kebab all of a sudden.

This feels like fallout from appending the menu to the very bottom of the page (.pf-v6-c-page__main-section or the whole <body>) without setting its position?

@martinpitt
Copy link
Member

In other words, shouldn't the position be set to the element that triggered the popup, not the target body/page?

@Venefilyn
Copy link
Member Author

In other words, shouldn't the position be set to the element that triggered the popup, not the target body/page?

Unfortunately that creates two scrollbars

@martinpitt
Copy link
Member

@Venefilyn I didn't mean the logical DOM structure, but the position: CSS attribute? I.e. moving the screen position around. That shouldn't create scrollbars?

Copy link
Member

@garrett garrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving, as it's better than what's there before and it's critical. Thanks! 🥳


I wonder if adding something like this in the popup code (tied to the element itself):

element.scrollIntoView({ behavior: "smooth", block: "nearest" });

(It should only scroll if it needs to scroll.)

Might help to make sure that the menu is on screen in a best effort, so there's minimal scrolling needed to actually see the menu. It should try to fit it and stop when the top is on screen, probably. (Or "nearest" might need to be "start" instead. But "start" might just say "well, the start is on screen". Unsure; we'd need to test.)

https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

(Perhaps it'd only work as intended if it is set to the row, if the menu is a child to it, to make sure the row is onscreen, as is the origin button, and also tries a best effort for the menu.)

This could be a follow-up. (Or it might not even work. But it could improve the experience on smaller screens, especially when scrolling isn't obvious.)

Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above, it cannot land like this, it makes the menu invisible in some circumstances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants