You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/06/14 13:31:26 UTC

[GitHub] [superset] kgabryje commented on a change in pull request #15141: chore: Scrolls top when opening a select filter

kgabryje commented on a change in pull request #15141:
URL: https://github.com/apache/superset/pull/15141#discussion_r650949325



##########
File path: superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx
##########
@@ -275,14 +292,15 @@ export default function PluginFilterSelect(props: PluginFilterSelectProps) {
         onSearch={searchWrapper}
         onSelect={clearSuggestionSearch}
         onBlur={handleBlur}
-        onDropdownVisibleChange={setIsDropdownVisible}
+        onDropdownVisibleChange={onDropdownVisibleChange}

Review comment:
       I think we can use a different (maybe a bit simpler?) approach here
   ```suggestion
           dropdownRender={originNode => {
             if (isDropdownVisible && !wasDropdownVisible) {
               originNode.ref?.current?.scrollTo(0);
             }
             return originNode;
           }}
   ```
   and before that:
   ```
   const wasDropdownVisible = usePrevious(isDropdownVisible);
   ```
   
   What do you think?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org