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

[KED-2988] Fix for plotly when escape button pressed #654

Merged
merged 8 commits into from
Nov 30, 2021

Conversation

rashidakanchwala
Copy link
Contributor

@rashidakanchwala rashidakanchwala commented Nov 25, 2021

Description

Jira Ticket - https://jira.quantumblack.com/browse/KED-2988

Development notes

Besides fixing the bug, I have also raised z-index for plotly modal so it comes on top of the global toolbar.
Update - Plotly Modal when expanded will show the global toolbar on the left so users can access settings/themes while viewing the modal (use-case - if they want to switch between light/dark theme while viewing the charts)

QA notes

Steps to produce the bug --

Run shuttle factory with Kedro-viz --> Click on node Uplift Report Figures' -- > Expland plotly chart --> Press escape

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

Copy link
Member

@tynandebold tynandebold left a comment

Choose a reason for hiding this comment

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

Great work! Just two small things and then we're good :)

src/components/plotly-modal/index.js Outdated Show resolved Hide resolved
@@ -21,7 +21,7 @@
right: 0;
bottom: 0;
left: 0;
z-index: 3;
z-index: 5;
Copy link
Member

Choose a reason for hiding this comment

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

Given we now have a global toolbar, that toolbar should almost always be visible.

With that in mind, I think we should keep the z-index at 3 and then bump over the the left value to 80px, since that's the width of the global toolbar.

There's actually a SCSS variable you can use for this here.

Copy link
Member

@tynandebold tynandebold left a comment

Choose a reason for hiding this comment

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

Works like a charm :)

I've left one small comment and I'll approve now. Great work.

@@ -20,7 +20,7 @@
top: 0;
right: 0;
bottom: 0;
left: 0;
left: 80px;
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest changing this hard-coded value to the variable we have set in the variables file, like we do here.

Copy link
Collaborator

@limdauto limdauto left a comment

Choose a reason for hiding this comment

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

LGTM just a minor comment

{metadata.node.name}
</span>
<>
{metadata && metadata.plot && (
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can potentially move this check to line 18 and short circuit there. IMO it's cleaner that way.

if (!visible.plotModal || metadata?.plot) {
    return null
}

Copy link
Member

Choose a reason for hiding this comment

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

Optional chaining for the win. Forgot this also works in vanilla JS, not just TS.

@rashidakanchwala I agree with Lim here. This is cleaner.

@rashidakanchwala rashidakanchwala merged commit 567ba58 into main Nov 30, 2021
@rashidakanchwala rashidakanchwala deleted the KED-2988/fix/plotly-crash-on-escape branch November 30, 2021 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants