Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Feb 7, 2025

Describe your changes

The dataframe column menu is broken when used in dialog or popover:

image

The reason is that the position: fixed doesn't work in this context since the dialog uses a transform -> which influences the position fixed. To fix this, we are putting the column menu inside the dataframe portal div that is also used for the cell overlays.

GitHub Issue Link (if applicable)

Testing Plan

  • Added e2e test

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@lukasmasuch lukasmasuch added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Feb 7, 2025
@lukasmasuch lukasmasuch changed the title Fix the usage of dataframe column menu in dialog [WIP] Fix the usage of dataframe column menu in dialog Feb 7, 2025
@lukasmasuch lukasmasuch changed the title [WIP] Fix the usage of dataframe column menu in dialog Fix the usage of dataframe column menu in dialog Feb 7, 2025
@lukasmasuch lukasmasuch marked this pull request as ready for review February 7, 2025 12:40
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR also applies two minor styling improvements. Use rem size for top margin, Move border to the inner element of the column menu (-> works better with the rounding of theming)

page.wait_for_function(check_script, arg=font_family, timeout=timeout)


def is_element_in_bounding_box_of(
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: is_element_in_bounding_box_of -> is_child_bounding_box_inside_parents

and I would probably swap the two arguments, child first and then the parent because the child element is mentioned in the function name first, too

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated 👍

column_menu = app.get_by_test_id("stDataFrameColumnMenu")
expect(column_menu).to_be_visible()
expect(column_menu).to_be_in_viewport()
assert is_element_in_bounding_box_of(df_element, column_menu)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: should we have a screenshot test for the open menu inside of dialogs as well? Checking the bounding box is great, but it could be inside of the bounding box and still look weird, right?

Copy link
Collaborator Author

@lukasmasuch lukasmasuch Feb 7, 2025

Choose a reason for hiding this comment

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

that was the first version, but I decided against screenshots since I don't want to spread out screenshots too much, and we already have a screenshot tests for column menu within dataframe in the normal dataframe tests.

@lukasmasuch lukasmasuch enabled auto-merge (squash) February 7, 2025 14:38
@lukasmasuch lukasmasuch merged commit 5b32f71 into develop Feb 7, 2025
32 checks passed
@lukasmasuch lukasmasuch deleted the fix/dataframe-column-menu-in-dialog branch February 7, 2025 15:41
sfc-gh-mbarnes pushed a commit that referenced this pull request Feb 17, 2025
The dataframe  column menu is broken when used in dialog or popover:

![image](https://github.com/user-attachments/assets/7f430dfb-a7c0-4b84-9dfd-72f3b4c4bcc9)

The reason is that the `position: fixed` doesn't work in this context
since the dialog uses a transform -> which influences the position
fixed. To fix this, we are putting the column menu inside the dataframe
portal div that is also used for the cell overlays.

- Closes #10357

- Added e2e test

---

**Contribution License Agreement**

By submitting this pull request you agree that all contributions to this
project are made under the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

st.dataframe Column Menu Misalignment Inside st.dialog

3 participants