Sponsored Content
The Wayback Machine - https://web.archive.org/web/20210817024837/https://github.com/google/site-kit-wp/issues/177
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

Javascript Required Messages #177

Closed
bjackson27 opened this issue Jul 10, 2019 · 11 comments
Closed

Javascript Required Messages #177

bjackson27 opened this issue Jul 10, 2019 · 11 comments
Milestone

Comments

@bjackson27
Copy link

@bjackson27 bjackson27 commented Jul 10, 2019 •

When Javascript is disabled, Site Kit pages are blank and do not load. While WordPress' functionality is severely limited if Javascript is disabled, it would be good to at least display a message in a <noscript> tag when loading SiteKit pages that Javascript is required to use Site Kit.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • When JavaScript is disabled in the browser, accessing any Site Kit admin screen (dashboard, module screens, settings), as well as the admin bar menu, should display a user-facing message: "The Site Kit by Google plugin requires JavaScript to be enabled in your browser."

Implementation Brief

  • Create a Requires_Javascript trait in the Core/Util namespace which provides a get_noscript_html method to return the <noscript> html as a string. This way we have a single source for all places we need to include the tag.
  • Add the <noscript> tag to the Screen render() method
    private function render( Context $context ) {
    if ( ! $this->args['render_callback'] ) {
    return;
    }
    call_user_func( $this->args['render_callback'], $context );
    }

    which calls render_callback() from each screen to ensure the tag is included for all Site Kit screens.
    The tag should only be rendered if there is a render_callback
  • Add <noscript> tag to the admin bar in Admin_Bar::menu_markup()
  • Add <noscript> tag to the activation banner in Activation::get_activation_notice
  • Add CSS to hide all Site Kit loading bars (and/or app render targets) if JS is not enabled using the body.no-js class
    • Ideally something like body.no-js #js-googlesitekit-*

QA Brief

Affected areas

  • Site Kit plugin activation notice
  • Site Kit WordPress dashboard widget
  • Site Kit splash (setup) pages
  • Site Kit module dashboard pages
  • Site Kit main dashboard page
  • Site Kit settings page
  • Admin Bar (post edit & post on front) for posts that have data in Search Console &/or Analytics

Expected Notice when JS is disabled

The Site Kit by Google plugin requires JavaScript to be enabled in your browser.

Steps

  1. Set up Site Kit as normal with JavaScript enabled
  2. Ensure each affected area does not display the above notice that JavaScript is required
  3. Disable JavaScript
  4. Ensure each affected area does display the above notice that JavaScript is required

Changelog entry

  • Add user-facing warnings to Site Kit areas when JavaScript is disabled.
@marrrmarrr marrrmarrr added the P2 label Jul 18, 2019
@marrrmarrr marrrmarrr assigned felixarntz and unassigned marrrmarrr Jul 18, 2019
@felixarntz felixarntz removed their assignment Jul 18, 2019
@lucymtc lucymtc assigned lucymtc and unassigned lucymtc Jul 18, 2019
@felixarntz felixarntz self-assigned this Jul 18, 2019
@felixarntz
Copy link
Member

@felixarntz felixarntz commented Jul 18, 2019

@lucymtc

Add <noscript> with message to the Screens.php admin_head existing action

This should be in a head action, it needs to be where the actual content markup is generated.

Also, the implementation brief doesn't cover the admin bar menu.

@felixarntz felixarntz assigned lucymtc and unassigned felixarntz Jul 18, 2019
@lucymtc
Copy link
Contributor

@lucymtc lucymtc commented Jul 20, 2019

@felixarntz for the admin pages it is specified to hook into admin_head
I have added implementation for admin bar.

@lucymtc lucymtc removed their assignment Jul 20, 2019
@felixarntz felixarntz self-assigned this Aug 12, 2019
@felixarntz
Copy link
Member

@felixarntz felixarntz commented Aug 12, 2019

@lucymtc Apologies, I originally wrote exactly the opposite of what I meant:

This should shouldn't be in a head action

<noscript> tags with the fallback messages should be rendered with the markup exactly where they should appear, for example in the render_callback() methods for the screen, or the Admin_Bar::menu_markup() method.

@felixarntz felixarntz assigned lucymtc and unassigned felixarntz Aug 12, 2019
@lucymtc
Copy link
Contributor

@lucymtc lucymtc commented Aug 31, 2019

Implementation brief updated

@lucymtc lucymtc removed their assignment Aug 31, 2019
@felixarntz
Copy link
Member

@felixarntz felixarntz commented Sep 2, 2019 •

Create helper in includes/Core/Util/ to return the <noscript> tag so we have a single source for any different places we need to include the tag.

Just to clarify, I think this should be implemented as a trait with a protected method, as it's quite specific (the Core/Util namespace is fine). We don't need an own class or public function for that. Other than that the IB looks solid.

@tofumatt
Copy link
Collaborator

@tofumatt tofumatt commented Feb 10, 2020

It's worth noting that Puppeteer has page.setJavaScriptEnabled( false ) so we should be able to write a straightforward E2E test for this one to ensure the right <noscript> content is being loaded.

@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Feb 14, 2020

@felixarntz I updated the IB to include the Activation notice/app since this hadn't changed since July. I also added a point to use CSS to hide loading bars, etc using core's no-js class that wp-admin provides. Everything else is the same so I don't think this warrants a full re-review, but please take a look and let us know if there's anything else needed here 👍

@aaemnnosttv aaemnnosttv self-assigned this Feb 18, 2020
@Shavindra Shavindra mentioned this issue Feb 19, 2020
12 tasks
@eclarke1 eclarke1 added this to the Sprint 17 milestone Feb 28, 2020
@eclarke1 eclarke1 removed this from the Sprint 17 milestone Mar 2, 2020
@eclarke1 eclarke1 added this to the Sprint 18 milestone Mar 2, 2020
@felixarntz felixarntz assigned aaemnnosttv and unassigned felixarntz Mar 2, 2020
@aaemnnosttv aaemnnosttv assigned felixarntz and unassigned aaemnnosttv Mar 3, 2020
@felixarntz felixarntz assigned aaemnnosttv and unassigned felixarntz Mar 5, 2020
@aaemnnosttv aaemnnosttv assigned felixarntz and unassigned aaemnnosttv Mar 5, 2020
@felixarntz felixarntz removed their assignment Mar 5, 2020
@cole10up
Copy link
Collaborator

@cole10up cole10up commented Mar 11, 2020

Tested

Disabled Javascript:

image

Confirmed the message is displayed:

image

Passed QA ✅

@cole10up cole10up removed their assignment Mar 11, 2020
@cole10up
Copy link
Collaborator

@cole10up cole10up commented Mar 12, 2020

Tested

Site Kit plugin activation notice
image

Site Kit WordPress dashboard widget
image

Site Kit splash (setup) pages
image

Site Kit module dashboard pages
image

Site Kit main dashboard page - Pass Above

Site Kit settings page
image

Admin Bar (post edit & post on front) for posts that have data in Search Console &/or Analytics
image

@aaemnnosttv
Copy link
Collaborator

@aaemnnosttv aaemnnosttv commented Mar 12, 2020

Thanks for the follow up screenshots @cole10up. I think they may be out of order or missing a few though.

To clarify a few things:

  • The setup/splash page is where you land if you click Site Kit > Dashboard in the admin menu but it hasn't been set up yet. This one (you labelled as "Activation notice")
    image

    • The activation notice is what shows up immediately after activating the plugin on plugins.php
  • Site Kit splash (setup) pages
    image

    • This is totally out of our hands as it's an accounts.google.com URL.
  • Admin Bar (post edit & post on front) for posts that have data in Search Console &/or Analytics

    • Your screenshot here doesn't show that the Site Kit admin bar menu item is there. You'll need to use the developer settings plugin and match the page/post URL to one that has data on the site that you're using in the Custom Site URL. It should essentially look the same as this one from the front-end though:
      image
  • Site Kit WordPress dashboard widget

    • This screenshot isn't showing the WordPress dashboard 😄 (/wp-admin/index.php)
@marrrmarrr
Copy link
Collaborator

@marrrmarrr marrrmarrr commented Mar 12, 2020

Verified this message appears on the main dashboard, single page stats, settings page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants