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

chore: Scrolls top when opening a select filter #15141

Merged
merged 1 commit into from Jun 15, 2021

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Jun 13, 2021

SUMMARY

Fixes #15029

@rusackas @junlincc @villebro

@geido If we add the inverseSelection prop to the new Select, then this logic will be needed.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

121098597-10325080-c7ab-11eb-88fb-dca5d032959d_kUroVy7a.mov
screen-recording-2021-06-13-at-25900-pm_cGjyCPjl.mov

TESTING INSTRUCTIONS

See before/after videos for instructions.

ADDITIONAL INFORMATION

  • Has associated issue:
  • 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 Jun 13, 2021

Codecov Report

Merging #15141 (3d6c6d2) into master (448c689) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #15141   +/-   ##
=======================================
  Coverage   77.26%   77.26%           
=======================================
  Files         969      969           
  Lines       49918    49924    +6     
  Branches     6393     6395    +2     
=======================================
+ Hits        38567    38573    +6     
  Misses      11148    11148           
  Partials      203      203           
Flag Coverage Δ
javascript 72.22% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...c/filters/components/Select/SelectFilterPlugin.tsx 80.18% <100.00%> (+1.13%) ⬆️

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 448c689...3d6c6d2. Read the comment docs.

@@ -275,14 +292,15 @@ export default function PluginFilterSelect(props: PluginFilterSelectProps) {
onSearch={searchWrapper}
onSelect={clearSuggestionSearch}
onBlur={handleBlur}
onDropdownVisibleChange={setIsDropdownVisible}
onDropdownVisibleChange={onDropdownVisibleChange}
Copy link
Member

Choose a reason for hiding this comment

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

I think we can use a different (maybe a bit simpler?) approach here

Suggested change
onDropdownVisibleChange={onDropdownVisibleChange}
dropdownRender={originNode => {
if (isDropdownVisible && !wasDropdownVisible) {
originNode.ref?.current?.scrollTo(0);
}
return originNode;
}}

and before that:

const wasDropdownVisible = usePrevious(isDropdownVisible);

What do you think?

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 it's a really great solution. Much more elegant! I'll make the changes and test it. Thank you!

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

@kgabryje kgabryje merged commit b3c1979 into apache:master Jun 15, 2021
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@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 size/S 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[native-filters][select]multiple select dropdown open from the top
3 participants