question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Permissions modal blocks outside clicks on WP dashboard

See original GitHub issue

Bug Description

When a request is made that requires additional permissions to be granted on the WP dashboard, the modal doesn’t display as usual and clicks are blocked in a non-obvious way.

Steps to reproduce

  1. Set up SK without Analytics
  2. Sign in with a different admin and connect Analytics
  3. Sign in with the first admin again
  4. See permissions modal on WP dashboard

Screenshots

https://user-images.githubusercontent.com/1621608/175376916-4421fa1f-fe4c-48b4-9931-8b3783305935.mp4


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

Acceptance criteria

  • Site Kit’s insufficient permissions modal should not be triggered on non-Site Kit screens

Implementation Brief

  • In assets/js/googlesitekit/constants.js:
    • Create a new definition named SITE_KIT_VIEW_CONTEXTS which should export an array of Site Kit only view contexts, e.g. VIEW_CONTEXT_DASHBOARD, VIEW_CONTEXT_PAGE_DASHBOARD, VIEW_CONTEXT_DASHBOARD_VIEW_ONLY, VIEW_CONTEXT_PAGE_DASHBOARD_VIEW_ONLY, VIEW_CONTEXT_USER_INPUT, VIEW_CONTEXT_DASHBOARD_SPLASH, VIEW_CONTEXT_SETTINGS, and VIEW_CONTEXT_MODULE_SETUP.
    • We’re creating a new definition here so that this can be re-used in future if needed.
  • In assets/js/util folder:
    • Create a new file named is-site-kit-screen.js.
    • Import the new SITE_KIT_VIEW_CONTEXTS definition.
    • From this file, export a new function named isSiteKitScreen which would accept viewContext as a parameter, and return a boolean value describing if the passed viewContext is a Site Kit screen.
    • Inside the function, check if the passed viewContext belongs to the new SITE_KIT_VIEW_CONTEXTS array definition.
    • Add necessary file header comments.
  • In assets/js/components/Root/index.js:

Test Coverage

  • No tests need to be added/updated.

QA Brief

  • Follow the steps above to reproduce the error.
  • Navigate to the WordPress dashboard, and locate the Site Kit widget
  • Ensure that the “Additional permissions required”-modal isn’t present
  • Ensure that all the other links on the WP dashboard can still be accessed

Changelog entry

  • Fix permissions modal issue on non Site Kit pages.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
aaemnnosttvcommented, Jul 11, 2022

IB ✅

1reaction
nfmohitcommented, Jul 11, 2022

Thank you for the detailed review @aaemnnosttv! I’ve updated the IB.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Block Visibility — Conditional Visibility Control for the Block ...
Show or hide any WordPress block with ease. Schedule when blocks should be visible. Restrict blocks to specific screen sizes, user roles, and...
Read more >
How to Limit Access to Your WordPress Dashboard
In this article, we explore some of the easiest ways to limit access for WP users using the admin, code, and plugins.
Read more >
What To Do When You Are Locked Out of WordPress Admin
Lost Admin Privileges​​ This can happen if your user permissions were modified. It could be that hackers have infected your site and then...
Read more >
Pop up modal to embed third party elements - Landbot Help
External API REST. Dynamic Data (Arrays). Webhook Blocks Dashboard. How to TEST your Http Request (Webhook block). Webhook block (External ...
Read more >
How to Manage Your Website Files from Inside Your ...
WP File Manager for WordPress Dashboard ... but even as you click into the main section, the plugin presents you with a fully...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found