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

Add warning to console about prototype kit usage #241

Merged
merged 1 commit into from
Oct 13, 2016

Conversation

edwardhorsford
Copy link
Contributor

Add a warning that gets printed to the console on the client side about not using the kit for production.

I've set it to only show once per session (using sessionStorage). This should hopefully strike a balance between being visible enough and not being too annoying.

Based on suggestion from @NickColley

screen shot 2016-08-17 at 12 31 52

window.console && window.console.info
) {
window.console.info('GOV.UK Prototype Kit - do not use for production');
window.sessionStorage.setItem('prototypeWarning', true);
Copy link
Contributor

@robinwhittleton robinwhittleton Aug 17, 2016

Choose a reason for hiding this comment

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

Presumably you want this to be set to 'false', right? Currently it’ll set it to true, then the next time you load the page check to see whether 'true' (converted internally to a string) is not equal to 'false' and show the message again. Personally, I don’t see the problem in showing it every page load though…

@robinwhittleton
Copy link
Contributor

robinwhittleton commented Aug 17, 2016

You don’t need to wait for the document to finish loading as you’re not touching it - you could move this out of the document ready block.

Apart from this and my other comment, it’s a nice approach.

@joelanman
Copy link
Contributor

this is a great idea. Mentioned elsewhere, but just so it's in one place:

prototype kit should be lower case

not sure about not showing every time - it means there's only one page view in a session that it will show, so someone will have to open the console on that one page view

@edwardhorsford
Copy link
Contributor Author

Probably for a separate discussion, but I consider the full name as a proper noun. I'm not sure where it was decided that it's lowercase?

It's not just in that one page view, as the console content is persistent across pages. It will be at the top of the console regardless of how many pages you've visited. I'd prefer to err on the side of not being annoying and aggressive in our warnings - if we do that, people will just turn them off.

@NickColley
Copy link
Contributor

NickColley commented Aug 18, 2016

My thought behind not having it every page load was that if you're debugging JavaScript it could be very annoying having a message in your console.

@joelanman
Copy link
Contributor

@edwardhorsford the console is not persistent across pages by default

gemmaleigh added a commit that referenced this pull request Oct 13, 2016
# 2.0.0

- Remove the images path override from the helpers partial ([PR
#292](alphagov/govuk_elements#292)). This will
break background images that are currently using the `file-url`
function from [the url-helpers partial in the frontend
toolkit](https://github.com/alphagov/govuk_frontend_toolkit/blob/d54c9b2
6d314a6e6cb50ba90f6e96ca50049498f/stylesheets/_url-helpers.scss). As
`$path` will vary from project to project you will need to define this
in your main application stylesheet.
- Bump govuk frontend toolkit to 4.16.1 ([PR
#288](alphagov/govuk_elements#288)). This adds
space key activation to links with a role of button.
- Form validation patterns for conditionally revealing content ([PR
#286](alphagov/govuk_elements#286))
- Centre text on full-width buttons ([PR
#289](alphagov/govuk_elements#289))
- Lint JS code using [StandardJS](http://standardjs.com/) ([PR
#290](alphagov/govuk_elements#290))

*This version deprecates external link styles. If your service has user
research that indicates that external links are useful (or not) then
we’d like to hear from you either on Slack,
[digital-service-designers](https://groups.google.com/a/digital.cabinet-
office.gov.uk/forum/#!forum/digital-service-designers) or [opening an
issue](https://github.com/alphagov/govuk_elements/issues/new).*

# 1.2.2

- Bump govuk frontend toolkit to 4.14.4 (PR #278)
- Add a .column-full class (PR #270)
- Add a file upload example (PR #268)
- Remove the blue outline from the main content area (PR #265)
- Fix legend text wrapping in IE (PR #248)

# 1.2.1

- Consistent spacing underneath block labels and toggled content (PR
#229)
- Remove underlines from abbreviations in Firefox (PR #241)
@gemmaleigh gemmaleigh force-pushed the kit-console-warning branch 2 times, most recently from e3c491e to 502564b Compare October 13, 2016 08:37
@robinwhittleton robinwhittleton merged commit ae709db into master Oct 13, 2016
@robinwhittleton robinwhittleton deleted the kit-console-warning branch October 13, 2016 08:42
robinwhittleton pushed a commit that referenced this pull request Oct 13, 2016
Breaking changes:

- #244 Migrate documentation into a seperate application

All changes:

- Bump all GOV.UK assets to their latest versions
- Remove duplicate GOV.UK assets copied to the app
- #241 Warn against using the prototype kit to build production services
- #268 Automatically keep the latest release branch up to date. This can be used to update the kit
- #270 Add a new stylesheet for the unbranded layout to fix font issues
- #257 Make CSS output easier to debug (with sourcemaps)
- #237 Make links with role="button" behave like buttons
- #224 Lint the prototype kit’s codebase using Standard. This only applies to the kit’s codebase - there’s no requirement for your app to meet this
robinwhittleton pushed a commit that referenced this pull request Oct 13, 2016
Breaking changes:

- #244 Migrate documentation into a separate application

All changes:

- Bump all GOV.UK assets to their latest versions
- Remove duplicate GOV.UK assets copied to the app
- #241 Warn against using the prototype kit to build production services
- #268 Automatically keep the latest release branch up to date. This can be used to update the kit
- #270 Add a new stylesheet for the unbranded layout to fix font issues
- #257 Make CSS output easier to debug (with sourcemaps)
- #237 Make links with role="button" behave like buttons
- #224 Lint the prototype kit’s codebase using Standard. This only applies to the kit’s codebase - there’s no requirement for your app to meet this
@robinwhittleton robinwhittleton mentioned this pull request Oct 13, 2016
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.

5 participants