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(Explore): fixes broken layout of tooltips #14529

Merged
merged 4 commits into from May 19, 2021

Conversation

rusackas
Copy link
Member

@rusackas rusackas commented May 7, 2021

SUMMARY

Fixes an issue where Explore control panels with long label text cause funky line-wrapping on mouseover. This was due to the span containing the tooltip(s) appearing inline, and getting to wide. This PR makes the tooltips absolutely positioned, so that they can't cause a line wrap. They might hang a little too far over to the right, but it's an improvement.

As bycatch, this moves a bunch of CSS from LESS files to the component itself, using Emotion and theme variables.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before:

Screen.Recording.2021-05-19.at.9.43.19.PM.mov

After:
fixed

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue: Fixes [explore] Dropdowns tooltip icon jumping when mouse is on label #12689
  • 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

@codecov
Copy link

codecov bot commented May 7, 2021

Codecov Report

Merging #14529 (2ad7a47) into master (1df9384) will increase coverage by 0.19%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #14529      +/-   ##
==========================================
+ Coverage   77.15%   77.35%   +0.19%     
==========================================
  Files         958      960       +2     
  Lines       48241    49357    +1116     
  Branches     5636     6055     +419     
==========================================
+ Hits        37219    38178     +959     
- Misses      10821    10959     +138     
- Partials      201      220      +19     
Flag Coverage Δ
hive 80.80% <ø> (ø)
javascript 72.63% <77.77%> (+0.62%) ⬆️
mysql 81.06% <ø> (ø)
postgres 81.09% <ø> (ø)
presto 80.79% <ø> (-0.01%) ⬇️
python 81.62% <ø> (-0.01%) ⬇️
sqlite 80.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../src/explore/components/ControlPanelsContainer.tsx 84.92% <75.00%> (-0.04%) ⬇️
...-frontend/src/explore/components/ControlHeader.jsx 85.71% <100.00%> (+0.52%) ⬆️
superset-frontend/src/components/Menu/Menu.tsx 64.86% <0.00%> (-4.61%) ⬇️
superset-frontend/src/CRUD/Field.jsx 79.41% <0.00%> (-3.93%) ⬇️
...erset-frontend/src/SqlLab/components/SaveQuery.tsx 71.83% <0.00%> (-3.17%) ⬇️
superset-frontend/src/components/Menu/SubMenu.tsx 96.93% <0.00%> (-3.07%) ⬇️
...onfigModal/FiltersConfigForm/FiltersConfigForm.tsx 68.77% <0.00%> (-1.46%) ⬇️
...d/src/explore/components/PropertiesModal/index.tsx 81.73% <0.00%> (-0.47%) ⬇️
superset/db_engine_specs/presto.py 89.89% <0.00%> (-0.43%) ⬇️
superset-frontend/src/dashboard/actions/hydrate.js 3.19% <0.00%> (-0.12%) ⬇️
... and 50 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1df9384...2ad7a47. Read the comment docs.

Copy link
Member

@villebro villebro 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 still getting the wrapping problem:
tooltip

.control-label {
margin-bottom: 0px;
position: relative;
span + span {
Copy link
Member

Choose a reason for hiding this comment

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

I was wondering if we should add class names to these and target those?

Copy link
Member Author

Choose a reason for hiding this comment

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

I went ahead and moved these styles to a better location. I'll sleep better now, thanks for the suggestion.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think they're a little more solid now too... see if you can break it 🤞

@rusackas
Copy link
Member Author

I'm still getting the wrapping problem:
tooltip

Ugh... it fixes SOME of them. Some are coming from a different component, and will require additional styles. More commits landing here soon.

@rusackas rusackas added the bash! label May 12, 2021
@junlincc junlincc added need:review Requires a code review hold! On hold and removed need:review Requires a code review labels May 13, 2021
@rusackas
Copy link
Member Author

@villebro You uncovered something gross... this PR only fixes SOME of the controls.

A bunch of controls use ControlHeader from superset, and some use ControlHeader from superset-ui 🤦

Proposed approach:

  1. Merge this (it fixes several)
  2. Merge a PR on superset-ui (which I'll open soon) that does the same thing with the ControlHeader on that side
  3. Bump in the @superset-ui/chart-controls package, and use that updated ControlHeader from superset-ui everywhere, and delete the duplicate one (this one!) from Superset.

@rusackas
Copy link
Member Author

Step 2 of the plan opened here: apache-superset/superset-ui#1107

@rusackas rusackas requested a review from villebro May 14, 2021 06:10
@@ -49,7 +49,16 @@ export default class ControlHeader extends React.Component {
renderOptionalIcons() {
if (this.props.hovered) {
return (
<span>
<span
css={theme => css`
Copy link
Member

Choose a reason for hiding this comment

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

css 👀 ... 🤣

Copy link
Member Author

Choose a reason for hiding this comment

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

The debate of the ages! I'm actually working on a doc to specify use cases for each, and try to arrive at some sort of best practices. I'll share it when it's fully baked.

Copy link
Member

@suddjian suddjian left a comment

Choose a reason for hiding this comment

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

LGTM in light of the plan™

@junlincc junlincc changed the title fix: moves LESS styles into Emotion, fixes broken layout of tooltips fix(Explore): fixes broken layout of tooltips May 18, 2021
@junlincc junlincc removed the hold! On hold label May 18, 2021
@junlincc
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

@junlincc Ephemeral environment spinning up at http://34.214.11.39:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@rusackas rusackas merged commit c2bd684 into master May 19, 2021
@rusackas rusackas deleted the fix-control-info-tooltip-positioning branch May 19, 2021 04:55
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
* fix: moves LESS styles into Emotion, fixes broken layout of tooltips

* fix: tests

* style: linting

* style: better styling location
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
* fix: moves LESS styles into Emotion, fixes broken layout of tooltips

* fix: tests

* style: linting

* style: better styling location
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
* fix: moves LESS styles into Emotion, fixes broken layout of tooltips

* fix: tests

* style: linting

* style: better styling location
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 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 preset-io size/M 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[explore] Dropdowns tooltip icon jumping when mouse is on label
6 participants