kgabryje commented on code in PR #26138:
URL: https://github.com/apache/superset/pull/26138#discussion_r1489518822


##########
superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx:
##########
@@ -573,15 +691,39 @@ const SliceHeaderControls = (props: 
SliceHeaderControlsPropsWithRouter) => {
         overlayStyle={dropdownOverlayStyle}
         trigger={['click']}
         placement="bottomRight"
+        visible={dropdownIsOpen}
       >
         <span
-          css={css`
+          css={() => css`
             display: flex;
             align-items: center;
           `}
           id={`slice_${slice.slice_id}-controls`}
           role="button"
           aria-label="More Options"
+          tabIndex={0}
+          onClick={() => {
+            toggleDropdown();
+          }}
+          onBlur={e => {
+            // close unless the dropdown menu is clicked
+            const relatedTarget = e.relatedTarget as HTMLElement;
+            if (
+              dropdownIsOpen &&
+              menuRef?.current?.props.id !== relatedTarget?.id
+            ) {
+              toggleDropdown({ close: true });
+            }
+          }}
+          onKeyDown={e =>

Review Comment:
   I'm wondering if it wouldn't be better to bake all that logic in 
`NoAnimationDropdown`. We could add those new props (onKeyDown, onBlur) to 
`NoAnimationDropdown` child by calling `cloneElement`



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to