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

fix(Dashboard): Support "Edit chart" click on a new window #28054

Merged
merged 2 commits into from
Apr 16, 2024

Conversation

geido
Copy link
Member

@geido geido commented Apr 16, 2024

SUMMARY

This PR #26138 removed the link from the "Edit chart" menu item on dashboards to enhance accessibility but it caused the chart to open in a new window. The goal of this PR is to support opening the chart in the same window by default while still allowing for opening a chart in a separate window with cmd + click.

It also removes an onBlur handler that was causing the interruption of some menu item actions by closing the dropdown abruptly.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N.A.

TESTING INSTRUCTIONS

  1. Click on "Edit chart" in a Dashboard
  2. The chart should open in the same window
  3. cmd + click, the chart should open in a new window

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

@geido geido requested review from eschutho and kgabryje April 16, 2024 11:25
@geido
Copy link
Member Author

geido commented Apr 16, 2024

/testenv up

Copy link
Contributor

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

@@ -590,7 +591,12 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {
case MenuKeys.ExploreChart:
// eslint-disable-next-line no-unused-expressions
props.logExploreChart?.(props.slice.slice_id);
window.open(props.exploreUrl);
if (domEvent.metaKey || domEvent.ctrlKey) {
Copy link
Member

Choose a reason for hiding this comment

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

A few questions here:

  1. Are we sure this works for mac and PC browsers as expected? Seems like it should, but ¯\_(ツ)_/¯
  2. Do we need tests to prevent this regressing again?
  3. Is there a reason we can't just use an HTML link here? I feel like we had that solved at one point.
  4. Is it not amazing that this particular link has been the subject of like 20 PRs and Issues?

Copy link
Member Author

Choose a reason for hiding this comment

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

  1. Yes it should
  2. Let me see what kind of tests I can add here
  3. We now enable dropdown navigation for accessibility by controlling onClick handlers
  4. Tests should hopefully fix this

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 will add the unit tests in a follow-up PR to unblock this bug fix

@geido geido merged commit 89da4f8 into master Apr 16, 2024
30 of 31 checks passed
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

@rusackas rusackas deleted the geido/fix/edit-chart-new-window branch April 16, 2024 18:10
betodealmeida pushed a commit that referenced this pull request Apr 25, 2024
qleroy pushed a commit to qleroy/superset that referenced this pull request Apr 28, 2024
jzhao62 pushed a commit to jzhao62/superset that referenced this pull request May 16, 2024
eschutho pushed a commit that referenced this pull request Jun 5, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 4.1.0 labels Nov 27, 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 🚢 4.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants