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: Button resizing in horizontal filter bar #22365

Merged

Conversation

michael-s-molina
Copy link
Member

SUMMARY

Previously, the DropdownContainer only showed the badge count when the value was greater than zero. When the badge count was updated, the button would change its width to incorporate the badge count. That behavior could really impact user experience because the position of the button can totally change if that needed extra space ends up pushing another element to the popover. To resolve that, this PR always displays the badge count even if the value is zero.

@kasiazjc Another possible solution would be to have more spacing between the button elements when there's no badge and less spacing when there's a badge. The important part would be to keep a constant button width. Let me know if you prefer that approach.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2022-12-07.at.4.52.58.PM.mov

TESTING INSTRUCTIONS

Check the video for instructions.

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

@codecov
Copy link

codecov bot commented Dec 7, 2022

Codecov Report

Merging #22365 (4b8a0d1) into master (de4f509) will not change coverage.
The diff coverage is 50.00%.

❗ Current head 4b8a0d1 differs from pull request most recent head 072929b. Consider uploading reports for the commit 072929b to get more accurate results

@@           Coverage Diff           @@
##           master   #22365   +/-   ##
=======================================
  Coverage   66.86%   66.86%           
=======================================
  Files        1847     1847           
  Lines       70562    70562           
  Branches     7741     7742    +1     
=======================================
  Hits        47179    47179           
  Misses      21382    21382           
  Partials     2001     2001           
Flag Coverage Δ
javascript 53.82% <50.00%> (ø)

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

Impacted Files Coverage Δ
...rontend/src/components/DropdownContainer/index.tsx 65.00% <0.00%> (ø)
superset-frontend/src/components/Badge/index.tsx 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

kgabryje
kgabryje previously approved these changes Dec 8, 2022
Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

Works great!

@kgabryje
Copy link
Member

kgabryje commented Dec 8, 2022

Can't we add a resize listener to the button and have the DropdownContainer recalculate its width?

@kasiazjc
Copy link
Contributor

kasiazjc commented Dec 8, 2022

Thanks @michael-s-molina!

Colorful badge was added as a visual cue to explicitly show that that some filters are currently applied and "0" count could be super confusing (we will use similar pattern in cross-filtering).

If there is no better way to fix it (or if Kamil's suggestion won't work) we could add "disabled" 0 state of the badge with tool tip that no filters are currently applied (for now/until we find a better solution). The increased width and empty space does not look good unfortunately :(

@pull-request-size pull-request-size bot added size/S and removed size/XS labels Dec 8, 2022
@michael-s-molina
Copy link
Member Author

@kasiazjc I added the disabled state and Kamil added the tooltip here.

Screen Shot 2022-12-08 at 11 09 33 AM

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

LGTM

@michael-s-molina michael-s-molina merged commit 3a442e0 into apache:master Dec 8, 2022
jinghua-qa pushed a commit to preset-io/superset that referenced this pull request Dec 10, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 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:2022.49 size/S 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants