-
Notifications
You must be signed in to change notification settings - Fork 21
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
CSS file is loaded in Marketing Overview page causing CSS issue #1765
Comments
I looked into this issue with the above solution in mind. I thought about how to determine whether the current page the user is in belongs to GLA plugin or not. I looked into things like WP Screen API, WC APIs like I came up with a solution to just check for the $wc_admin_condition = function() {
$path = urldecode( $_GET['path'] ?? '' );
return wc_admin_is_registered_page() && str_starts_with( $path, '/google/' );
}; The above is based on the google-listings-and-ads/js/src/index.js Lines 53 to 139 in 161f254
An assumption I made is that when we navigate between GLA pages and non-GLA pages, it is always a full page loading, not a dynamic front-end React routing. However, as pointed out by @eason9487 helpfully in our Slack conversation (p1672325494543439/1672320930.039149-slack-C046L2P9BEK), that is not always the case. Specifically, if we are navigating from or to pages without
If we are navigating between pages with
The solution I proposed above wouldn't work for navigation between pages with demo-wc-admin-condition-wc-admin-pages.mp4@eason9487 suggested to consider one or both of the following approaches to see if they could fix this issue:
|
📝 Related issue: #1391 |
I'm going to try this approach, by doing the above import in the |
Describe the bug:
When Google Listings and Ads is installed and activated, and we visit the Marketing Overview page (
/wp-admin/admin.php?page=wc-admin&path=%2Fmarketing
), its CSS file (/wp-content/plugins/google-listings-and-ads/js/build/index.css?ver=1668185841
) is loaded.This causes a CSS issue in the Multichannel Marketing page. I noticed this when I was working on PR woocommerce/woocommerce#35542. See screenshots below.
When GLA is not installed, things look as expected:
When GLA is installed and activated, the expand/collapse button icon becomes much smaller, and that's because of the
padding: 0 8px
:I did some searches in the code base and I couldn't find the relevant CSS. I suspect the padding CSS comes from the bundled
@wordpress/component
package.Possible solution 1 - does not work
(Update: This does not work, see #1765 (comment)).
I think the solution to this issue is that we should not load the CSS file when we are not in GLA pages.
The CSS file is loaded here - notice the
$wc_admin_condition
:google-listings-and-ads/src/Admin/Admin.php
Lines 137 to 143 in 23c09d8
$wc_admin_condition
is defined as:google-listings-and-ads/src/Admin/Admin.php
Lines 106 to 108 in 23c09d8
We probably just need to specify additional checks in the function so that the CSS file is only loaded when we are in GLA pages and not in Marketing Overview page.
Possible solution 2
As per #1765 (comment), @eason9487 suggested to consider one or both of the following approaches to see if they could fix this issue:
Button
byimport { Button } from 'extracted/@wordpress/components'
.gla-admin-page
CSS class including the@import "node_modules/@wordpress/components/src/button/style"
for scoping the GLA required adjustments.Steps to reproduce:
/wp-admin/admin.php?page=wc-settings&tab=advanced§ion=features
) and enable Multichannel Marketing experience./wp-admin/admin.php?page=wc-admin&path=%2Fmarketing
).Expected behavior:
The expand/collapse button should appear as normal size.
Actual behavior:
The expand/collapse button would appear small in size.
The text was updated successfully, but these errors were encountered: