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: Explore popovers should close on escape #19902

Conversation

diegomedina248
Copy link
Contributor

SUMMARY

This PR enables the popovers in the explore to be closed when hitting the escape key.
Also, improves the locking of the explore scroll, so that the popovers are pinned to the triggering div until they're closed.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No way to visually show the difference, so this is the actual result:

new.mov

TESTING INSTRUCTIONS

In the explore:

  • Try to edit the Data, be it metrics, columns, dimensions, filters, etc, and ensure it continues to work as before
  • Hit the escape key while a popover is open and ensure it closes
  • Ensure you can still interact with the popver (type, click, etc).

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 Apr 29, 2022

Codecov Report

Merging #19902 (2fd9355) into master (fdf48c6) will increase coverage by 0.00%.
The diff coverage is 95.45%.

@@           Coverage Diff           @@
##           master   #19902   +/-   ##
=======================================
  Coverage   66.54%   66.54%           
=======================================
  Files        1714     1714           
  Lines       65102    65118   +16     
  Branches     6725     6729    +4     
=======================================
+ Hits        43321    43335   +14     
- Misses      20069    20070    +1     
- Partials     1712     1713    +1     
Flag Coverage Δ
javascript 51.27% <95.45%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
...ponents/controls/ControlPopover/ControlPopover.tsx 89.09% <95.45%> (-0.66%) ⬇️

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 fdf48c6...2fd9355. Read the comment docs.

...props
}) => {
const triggerElementRef = useRef<HTMLElement>();

const [visible, setVisible] = useState(
Copy link
Contributor

Choose a reason for hiding this comment

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

Totally, I don't think that introducing visible state here is a good idea.
We can control visibleProps.
Currently you are mixing visible state and visible props to control visible, but it is not a good idea.

Copy link
Contributor Author

@diegomedina248 diegomedina248 May 2, 2022

Choose a reason for hiding this comment

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

We need the visible state locally to control the popover in this component.
The "visible" prop can be undefined, (leaving the component in an uncontrolled manner), that's why we need to take over the control, and can't rely on simple calling the onVisibleChange callback

@diegomedina248 diegomedina248 force-pushed the feat/explore-popovers-show-close-on-escape branch from 4431013 to 2fd9355 Compare May 4, 2022 16:07
Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

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

LGTM

@rusackas rusackas merged commit dbc653d into apache:master May 13, 2022
@sadpandajoe
Copy link
Member

🏷️ preset:2022.19

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request May 16, 2022
* feat: Explore popovers should close on escape

* review comments

(cherry picked from commit dbc653d)
philipher29 pushed a commit to ValtechMobility/superset that referenced this pull request Jun 9, 2022
* feat: Explore popovers should close on escape

* review comments
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 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.19 Preset-Patch size/L 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants