-
Notifications
You must be signed in to change notification settings - Fork 9.6k
report: make urls clickable #9224
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
Conversation
|
|
||
| const element = this._dom.createElement('div', 'lh-text__url'); | ||
| element.appendChild(this._renderText(displayedPath)); | ||
| element.appendChild(this._renderAnchor(displayedPath, url)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like we should rename this method now ;)
maybe we can also share some logic with renderLink at this point since I was about to make _renderAnchor comments about falling back to text on invalid, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, didn't see that method. done.
| const element = this._dom.createElement('a', 'lh-anchor'); | ||
| element.textContent = text; | ||
| element.href = href; | ||
| element.target = '_blank'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget rel=noopener ;)
|
|
||
| const element = this._dom.createElement('div', 'lh-text__url'); | ||
| element.appendChild(this._renderText(displayedPath)); | ||
| element.appendChild(this._renderLink(displayedPath, new URL(url))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to move the URL construction out of _renderLink, since that's the error-prone step @patrickhulce was running into and is adding the guard against in #9067.
Can be
| element.appendChild(this._renderLink(displayedPath, new URL(url))); | |
| element.appendChild(this._renderLink({text: displayedPath, url})); |
| </span> | ||
| <span class="crc-node__tree-value"> | ||
| <span class="crc-node__tree-file"><!-- fill me: node.request.url.file --></span> | ||
| <a class="lh-link crc-node__tree-file" target="_blank"><!-- fill me: node.request.url.file --></a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obviously we do need to run lighthouse against itself, also need noopener here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one day :)
Co-Authored-By: Brendan Kenny <[email protected]>
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
paulirish
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should apply a text-decoration on hover if it's not linked.. I started looking into why that happens and then #9237 happened.
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
|
||
| .lh-text__url > .lh-text, .lh-text__url-host { | ||
| .lh-text__url-host { | ||
| display: inline; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@paulirish why is this a div in the first place then?
| assert.equal(urlEl.title, urlText); | ||
| assert.equal(urlEl.dataset.url, urlText); | ||
| assert.ok(urlEl.firstChild.classList.contains('lh-text')); | ||
| assert.equal(urlEl.firstChild.nodeName, 'A'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you expand the tests of this anchor (here and below) now that it's more than just an .lh-text with the url? Can probably c/p from the renders link values test (though that doesn't appear to check the .lh-text__url-host stuff?)
| assert.equal(chains[1].querySelector('.crc-node__tree-file').textContent, '/b.js'); | ||
| assert.equal(chains[1].querySelector('.crc-node__tree-hostname').textContent, '(example.com)'); | ||
| assert.equal(chains[1].querySelector('.lh-text__url a').textContent, '/b.js'); | ||
| assert.equal(chains[1].querySelector('.lh-text__url-host').textContent, '(example.com)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these tests should also be expanded
| } | ||
|
|
||
| // Fill in url, host, and request size information. | ||
| const {file, hostname} = Util.parseURL(segment.node.request.url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The chain renderer now looks like this when run on the root url of a site:
this is an improvement, IMO.
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
patrickhulce
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@paulirish FYI I think your review has been addressed now that your PR has been merged
| } | ||
| } | ||
|
|
||
| // Alias b/c the name is really long. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆 this is great
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
|
any further change requests? @brendankenny @paulirish |


URLs in tables and in the critical request chain details are now clickable.
NYT: https://misc-hoten.surge.sh/www.nytimes.com_2019-06-17_11-40-25.report.html
See #5443