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

Bug 1820307: Hide yaml editor links when window width is less than 991px #4926

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
@import '~bootstrap-sass/assets/stylesheets/bootstrap/variables';

.ocs-yaml-editor-toolbar {
&__links {
display: flex;
flex-shrink: 0;
justify-content: flex-end;
margin: 2px;
z-index: 1;
@media(max-width: 767px) {
@media(max-width: $screen-sm-max) {
Copy link
Member

Choose a reason for hiding this comment

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

The downside to this fix is it also hides the View shortcuts link at viewport sizes 768 - 991, which seems like a regression in functionality. @spadgett, thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is how the original yaml-editor used to behave. I checked it on a 4.4 cluster as well. There was no other logic to toggle showSidebar link based on the window width apart from this css - https://github.com/openshift/console/blob/master/frontend/public/components/_edit-yaml.scss#L47

Copy link
Member

Choose a reason for hiding this comment

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

Can you double check?

Without your change I see the links because the toolbar is visible starting at 768px.
Screen Shot 2020-04-06 at 2 33 25 PM

With your change I do not see the links because the toolbar is visible starting at 992px.
Screen Shot 2020-04-06 at 2 33 02 PM

Note the regression is specific to viewport sizes 768 - 991.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, when I ported the CSS changes for the links component I added 768px by mistake instead of 991px which was the original value for $screen-sm-max. So originally the toolbar was only visible above 991px screen size. That is why I reverted back to the original value in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ah. Thanks, @rohitkrai03.

display: none;
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/components/edit-yaml.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const EditYAML_ = connect(stateToProps)(
stale: false,
sampleObj: props.sampleObj,
fileUpload: props.fileUpload,
showSidebar: props.create,
showSidebar: !!props.create,
};
this.monacoRef = React.createRef();
// k8s uses strings for resource versions
Expand Down