-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Paste/input gist URL for mobile. Fixes #1283 #1341
Conversation
@@ -284,6 +301,44 @@ class LighthouseViewerReport { | |||
} | |||
|
|||
/** | |||
* Handles changes to the gist url input. | |||
*/ | |||
onInputChange(e) { |
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.
what does this look like on mobile then after entering the url, keyboard prompts done? should we add our own button?
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 user needs to click outside the input or hit enter on the keyboard for it to fetch the gist. Once that's done (change
event fires and the gist is fetched), we go straight to showing the gist.
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 doubt anyone will hand-type the URL, but those that do will have to do as eric said.
for those on mobile devices that just paste the URL into the field, it'll trigger immediately after paste. (i just tested it out)
@patrickhulce wdyt? |
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.
generally works for me.
return; | ||
} | ||
|
||
const id = url.href.substring(url.href.lastIndexOf('/') + 1); |
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.
want to pull it out with a regex instead? seems slightly more robust.
i think the following would work..:
new URL(location.href).pathname.match(/[a-f0-9]{5,}/)
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.
done
PTAL |
So the viewer now has a few options:
Is that correct? If so, I think we could adjust some copy.. Here's a proposal:
|
Updated the copy. I went wit this:
I kept the input placeholder as "Enter or paste a Gist URL" because "Paste Gist URL or report JSON here" makes it sound like you can paste a json file into the input. |
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.
sgtm!
R: all
Part of #1283. On mobile, you'll get a url input:
On mobile/desktop, you'll be able to paste the URL of a gist. Invalid urls will cause a butter bar warning.