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

feat: Automatically closes the DropdownContainer when scrolling outside of the component #22287

Conversation

michael-s-molina
Copy link
Member

SUMMARY

Automatically closes the DropdownContainer when scrolling outside of the component.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screen.Recording.2022-11-30.at.4.23.05.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 Nov 30, 2022

Codecov Report

Merging #22287 (1945a5f) into master (309c064) will increase coverage by 0.00%.
The diff coverage is 80.00%.

@@           Coverage Diff           @@
##           master   #22287   +/-   ##
=======================================
  Coverage   66.89%   66.89%           
=======================================
  Files        1846     1846           
  Lines       70297    70302    +5     
  Branches     7688     7689    +1     
=======================================
+ Hits        47023    47027    +4     
- Misses      21280    21281    +1     
  Partials     1994     1994           
Flag Coverage Δ
javascript 53.79% <80.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...rontend/src/components/DropdownContainer/index.tsx 75.00% <80.00%> (+0.37%) ⬆️

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

@@ -249,6 +249,14 @@ const DropdownContainer = forwardRef(
[ref],
);

// Closes the popover when scrolling on the document
useEffect(() => {
document.onscroll = () => setPopoverVisible(false);
Copy link
Member

Choose a reason for hiding this comment

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

Can we add throttling? Or call it only if popover is open?

Copy link
Member

Choose a reason for hiding this comment

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

Or we could even add the scroll listener when popover opens and remove it when popover closes

Copy link
Member Author

Choose a reason for hiding this comment

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

Good suggestion. I changed the code to remove the listener when closing the popover and tested that it does not require throttling.

@kgabryje
Copy link
Member

kgabryje commented Dec 1, 2022

/testenv up FEATURE_HORIZONTAL_FILTER_BAR=true

@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

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

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 8cf5728 into apache:master Dec 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

Ephemeral environment shutdown and build artifacts deleted.

@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 size/S 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants