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

report(viewer): fix gist icon #12505

Merged
merged 3 commits into from May 19, 2021
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
8 changes: 4 additions & 4 deletions lighthouse-core/report/html/templates.html
Expand Up @@ -323,8 +323,8 @@
background-color: var(--color-gray-200);
outline: none;
}
/* save-as-gist option hidden in report */
.lh-tools__dropdown .lh-tools--gist {
/* save-gist option hidden in report. */
.lh-tools__dropdown a[data-action='save-gist'] {
display: none;
}

Expand Down Expand Up @@ -393,8 +393,8 @@
<a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--copy" data-i18n="dropdownCopyJSON" data-action="copy"></a>
<a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--download" data-i18n="dropdownSaveHTML" data-action="save-html"></a>
<a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--download" data-i18n="dropdownSaveJSON" data-action="save-json"></a>
<a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--open lh-tools--viewer" data-i18n="dropdownViewer" data-action="open-viewer"></a>
<a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--open lh-tools--gist" data-i18n="dropdownSaveGist" data-action="save-gist"></a>
<a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--open" data-i18n="dropdownViewer" data-action="open-viewer"></a>
<a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--open" data-i18n="dropdownSaveGist" data-action="save-gist"></a>
<a role="menuitem" tabindex="-1" href="#" class="report-icon report-icon--dark" data-i18n="dropdownDarkTheme" data-action="toggle-dark"></a>
</div>
</div>
Expand Down
8 changes: 5 additions & 3 deletions lighthouse-viewer/app/src/viewer-ui-features.js
Expand Up @@ -33,7 +33,8 @@ class ViewerUIFeatures extends ReportUIFeatures {

// Disable option to save as gist if no callback for saving.
if (!this._saveGistCallback) {
const saveGistItem = this._dom.find('.lh-tools--gist', this._document);
const saveGistItem =
this._dom.find('.lh-tools__dropdown a[data-action="save-gist"]', this._document);
saveGistItem.setAttribute('disabled', 'true');
}
}
Expand All @@ -58,8 +59,9 @@ class ViewerUIFeatures extends ReportUIFeatures {
throw new Error('Cannot save this report as a gist');
}

// Disable save-as-gist option after saving.
const saveGistItem = this._dom.find('.lh-tools--gist', this._document);
// Disable save-gist option after saving.
const saveGistItem =
this._dom.find('.lh-tools__dropdown a[data-action="save-gist"]', this._document);
saveGistItem.setAttribute('disabled', 'true');
}
}
Expand Down
10 changes: 5 additions & 5 deletions lighthouse-viewer/app/styles/viewer.css
Expand Up @@ -123,12 +123,12 @@
z-index: 3;
}

/* open-in-viewer option hidden in Viewer */
.lh-tools__dropdown .lh-tools--viewer {
/* open-viewer option hidden in Viewer */
.lh-tools__dropdown a[data-action="open-viewer"] {
display: none;
}

/* open-in-gist option visible in Viewer */
.lh-tools__dropdown .lh-tools--gist {
display: block !important;
/* save-gist option visible in Viewer */
.lh-tools__dropdown a[data-action="save-gist"] {
display: flex !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

heh, does this affect anything or just for funsies? :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah the icon stuff requires flex, not block. i dont recall why

}