Skip to content

Conversation

@lukasmasuch
Copy link
Collaborator

@lukasmasuch lukasmasuch commented Apr 24, 2023

📚 Context

This PR implements tooltip capabilities for the dataframe frontend component (st.dataframe & st.data_editor). This will enable us to implement column-level help tooltips (when hovering the column header) and cell-level tooltips for showing warnings or other information.

The way how the tooltip component is implemented is a bit of a workaround: For the most part it is the same as the shared tooltip implementation, but we cannot use that one since it is a StatefulTooltip and requires a target component and cannot be triggered programmatically. We need to be able to position the tooltip anywhere on the screen, so we use a Popover instead. Since Popover doesn't support positioning to a virtual position, which requires us to use an invisible div as a workaround.

  • What kind of change does this PR introduce?

    • Bugfix
    • Feature
    • Refactoring
    • Other, please describe:
Screen.Recording.2023-04-14.at.20.25.27.mov

🧪 Testing Done

  • Screenshots included
  • Added/Updated unit tests
  • Added/Updated e2e tests

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 the security-assessment-completed Security assessment has been completed for PR label Apr 25, 2023
@lukasmasuch lukasmasuch marked this pull request as ready for review April 25, 2023 13:40
@kajarenc
Copy link
Collaborator

Looks good!

I think this is complex functionality and it is almost impossible to implement this simpler (without a workaround of invisible divs etc.)

I think we should add a couple of scenarios for manual testing during the QA process, since they would be difficult to test automatically, e.g. tooltip behavior when scrolling or resizing happens.

@lukasmasuch
Copy link
Collaborator Author

I think we should add a couple of scenarios for manual testing during the QA process, since they would be difficult to test automatically, e.g. tooltip behavior when scrolling or resizing happens.

Yep, agreed! I will start a document for QA and write that down 👍 I really hope that it will get a bit easier with playwright web to test these interactive scenarios e2e 🤞

@lukasmasuch
Copy link
Collaborator Author

lukasmasuch commented Apr 25, 2023

I think this is complex functionality and it is almost impossible to implement this simpler (without a workaround of invisible divs etc.)

Yep, I investigated for quite some time to find another way... but it seems impossible with what baseweb provides us, and I decided against adding another tooltip library just for this case. At least with this implementation, we can reuse parts of the styles.

@lukasmasuch lukasmasuch merged commit 5d4eef2 into develop Apr 25, 2023
tconkling added a commit to tconkling/streamlit that referenced this pull request Apr 25, 2023
* develop:
  Decouple MetricsManager from AppNode (streamlit#6557)
  Fix top padding on sidebar when embed is true (streamlit#6565)
  Add support for cell and column header tooltips in the dataframe component (streamlit#6561)
  Update dataframe column properties on frontend (streamlit#6554)
  Show warning for unsafe integer cells in `st.dataframe` (streamlit#6549)
  Add icon for editable columns in `st.data_editor` (streamlit#6550)
  Unify missing values to None in the returned datastructure by `st.data_editor`.  (streamlit#6544)
  Clean up and reorganize element tree module (streamlit#6522)
  ESLint: use `--cache` flag (30x speedup!) (streamlit#6555)
  Replace `st.connection` with `st.experimental_connection` in docstring examples (streamlit#6553)
  Improve editing on touch devices for `st.data_editor` (streamlit#6548)
  Move pandas styler logic to dedicated module (streamlit#6543)
@sfc-gh-kmcgrady sfc-gh-kmcgrady deleted the feature/add-dataframe-tooltips branch October 5, 2023 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants