Permissions modal blocks outside clicks on WP dashboard
See original GitHub issueBug 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
- Set up SK without Analytics
- Sign in with a different admin and connect Analytics
- Sign in with the first admin again
- 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_CONTEXTSwhich 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, andVIEW_CONTEXT_MODULE_SETUP. - We’re creating a new definition here so that this can be re-used in future if needed.
- Create a new definition named
- In
assets/js/utilfolder:- Create a new file named
is-site-kit-screen.js. - Import the new
SITE_KIT_VIEW_CONTEXTSdefinition. - From this file, export a new function named
isSiteKitScreenwhich would acceptviewContextas a parameter, and return a boolean value describing if the passedviewContextis a Site Kit screen. - Inside the function, check if the passed
viewContextbelongs to the newSITE_KIT_VIEW_CONTEXTSarray definition. - Add necessary file header comments.
- Create a new file named
- In
assets/js/components/Root/index.js:- Import the new
isSiteKitScreenfunction. - Conditionally render the
<PermissionsModal />component only if it is a Site Kit screen by passing the currentviewContextto theisSiteKitScreenfunction: https://github.com/google/site-kit-wp/blob/36283af816b31d6eca0ba020b09386c45a0612ff/assets/js/components/Root/index.js#L66
- Import the new
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:
- Created a year ago
- Comments:7
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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