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

fix: filters panel broken due to tabs scroll #30180

Conversation

justinpark
Copy link
Member

@justinpark justinpark commented Sep 6, 2024

SUMMARY

Fixes #30058

The EChart tooltip is hidden using visibility: hidden with opacity: 0 after it disappears, which causes tooltips generated from the previous tab to be recognized as scroll items when configuring the layout for the next tab, resulting in unnecessary scrollbars.

display:none means that the tag in question will not appear on the page at all (although you can still interact with it through the dom). There will be no space allocated for it between the other tags.

visibility:hidden means that unlike display:none, the tag is not visible, but space is allocated for it on the page. The tag is rendered, it just isn't seen on the page.

This commit addresses the issue by using a CSS hack to change the visibility hidden tooltip to display: none, effectively removing it and resolving the scrollbar problem.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

before--css-hide-hack.mov

After:

after--css-hide-hack.mov

TESTING INSTRUCTIONS

  1. Create a dashboard with 2 inner tabs
  2. In one tab, add a bunch of charts so that it needs scrolling
  3. In the other tab, add a few charts so it does not need scrolling
  4. Create a native filter
  5. Scroll to the bottom on the first tab and mouse over a chart to show a tooltip
  6. Select the second tab
  7. Check that the dashboard height is not calculated correctly and presents a scroll
  8. Scroll to the bottom and see the native filters panel break

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added dashboard:tab Related to the usage of tabs in the Dashboard viz:charts:tooltip Related to tooltips in charts labels Sep 6, 2024
@justinpark
Copy link
Member Author

@michael-s-molina I also confirmed that this bug exists in 4.0 as well.

// https://github.com/apache/superset/issues/30058
.echarts-tooltip[style*='visibility: hidden'] {
display: none !important;
}
Copy link
Member

Choose a reason for hiding this comment

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

Couple of options if you want to optimize further:

  1. we can probably narrow this from Superset global to being part of the ECharts plugin(s), perhaps using Emotion Globals.
  2. This might be a good excuse to open a PR on ECharts and fix it at the root ;)

Either way, I don't see this as a blocker for now. Things are lookin' good!

Copy link
Member Author

@justinpark justinpark Sep 9, 2024

Choose a reason for hiding this comment

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

Approach 2 is, of course, the fundamental solution, but I decided to leave it as a long-term solution considering the time gap involved in merging the patch and testing Superset compatibility with the corresponding version. (I plan to propose a related PR to echart later.)
Initially, I considered Approach 1, but I had concerns that adding a dependency on @emotion/react to the plugins' npm package might open the possibility for other custom plugins to apply custom global CSS. Therefore, I opted for this approach.

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

LGTM... we can probably get fancy with how/where we do this, but this works well for today!

@sadpandajoe sadpandajoe added the v4.1 Label added by the release manager to track PRs to be included in the 4.1 branch label Sep 6, 2024
@justinpark justinpark merged commit be0a0ce into apache:master Sep 11, 2024
41 of 42 checks passed
@justinpark justinpark deleted the hotfix--echart-tooltip-remain-in-the-middle-of-prev-tab branch September 11, 2024 23:30
sadpandajoe pushed a commit that referenced this pull request Sep 12, 2024
@github-actions github-actions bot added 🍒 4.1.0 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels dashboard:tab Related to the usage of tabs in the Dashboard plugins size/XS v4.1 Label added by the release manager to track PRs to be included in the 4.1 branch viz:charts:tooltip Related to tooltips in charts 🍒 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Native filters panel break due to tabs scroll
3 participants