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 "Shared with you" badge to Extensions > My Subscriptions list as applicable #46229

Merged
merged 24 commits into from May 17, 2024

Conversation

Dan-Q
Copy link
Contributor

@Dan-Q Dan-Q commented Apr 4, 2024

Changes proposed in this Pull Request:

Fixes WCCOM#19063.

To make it easier to see when an extension is available because of a shared subscription, this PR amends the Extensions > My Subscriptions page for connected stores to:

  • Add a "Shared with you" badge to products available as a result of a shared subscription
    • In a popup, shows the email address of the person who shared the subscription with you and a link to "learn more"
  • Removes the "Manage on Woo.com" link from the actions menu for subscriptions shared with you
  • Reduces the font size on such badges to 12px, in accordance with the latest designs
  • Improves the spacing of these badges, where multiple badges appear on multiple lines, so they don't collide

Screenshot highlighting the new badge and edited action menu.

How to test the changes in this Pull Request:

  1. Connect a store using a Woo.com account that has at least one subscription shared with it.
  2. In WooCommerce > Extensions > My Subscriptions, observe the new "Shared with you" badge.
  3. Click on the badge to see the email address of the person sharing it and a link to the sharing documentation.
  4. Note that the font size of the badge is now 12px.
  5. Click the kebab menu menu and observe that the "Manage on Woo.com" link does not appear for shared subscriptions.
  6. (Optional) Force a second badge to appear, e.g. by manually editing plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/table/rows/functions.tsx and adding another <StatusPopover>; observe that the badges have both horizontal and now vertical margins to prevent them from colliding with one another.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

For shared subscriptions, My Subscriptions now shows "Shared with you" and the email address of the person who shared it with you.

Comment

@Dan-Q Dan-Q self-assigned this Apr 4, 2024
@Dan-Q Dan-Q requested review from a team, andfinally and raja651 and removed request for a team April 4, 2024 15:20
@Dan-Q Dan-Q marked this pull request as ready for review April 4, 2024 15:20
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Apr 4, 2024
Copy link
Contributor

github-actions bot commented Apr 4, 2024

Hi @andfinally, @raja651,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@andfinally andfinally force-pushed the add/wccom19063-in-app-shared-by-badge branch from 7c90bc8 to 86abab3 Compare April 8, 2024 14:49
Copy link
Contributor

@andfinally andfinally left a comment

Choose a reason for hiding this comment

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

This is a brilliant improvement, thanks! 👌

I wonder if there's anything we can do about the tooltip width? With my (admittedly unnaturally long) test email address, I get an ugly scrollbar.

Also, I just noticed the behaviour of this and the tooltip on the Expired badge is a bit annoying. It won't go away till you click the badge again. This is not very intuitive, IMHO. I notice we use the same component for the kebab menu, but I think we add an outside click handler when we show it, so you can close it by clicking anywhere outside it.

@Dan-Q
Copy link
Contributor Author

Dan-Q commented Apr 16, 2024

I wonder if there's anything we can do about the tooltip width? With my (admittedly unnaturally long) test email address, I get an ugly scrollbar.

We can't change the width of the tooltip to anything sensible without breaking all kinds of other bits of design. How about we just make it so that exceptionally-long email addresses are allowed to wrap. It's the least-bad option, and only requires a single word-wrap: anywhere; CSS directive:

Screen.Recording.2024-04-16.at.19.21.30.mov

@Dan-Q
Copy link
Contributor Author

Dan-Q commented Apr 16, 2024

Also, I just noticed the behaviour of this and the tooltip on the Expired badge is a bit annoying. It won't go away till you click the badge again. This is not very intuitive, IMHO. I notice we use the same component for the kebab menu, but I think we add an outside click handler when we show it, so you can close it by clicking anywhere outside it.

Suggest this is treated as a separate issue, as (a) it applies to all the <StatusPopover>s everwhere, and (b) should probably be fixed centrally for them all, which is kinda out-of-scope for this issue.

@Dan-Q
Copy link
Contributor Author

Dan-Q commented Apr 16, 2024

I wonder if there's anything we can do about the tooltip width? With my (admittedly unnaturally long) test email address, I get an ugly scrollbar.

We can't change the width of the tooltip to anything sensible without breaking all kinds of other bits of design. How about we just make it so that exceptionally-long email addresses are allowed to wrap. It's the least-bad option, and only requires a single word-wrap: anywhere; CSS directive:

Done in e636709.

@Dan-Q Dan-Q requested a review from andfinally April 16, 2024 18:37
Copy link
Contributor

@andfinally andfinally left a comment

Choose a reason for hiding this comment

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

Thanks, looks good! I get your points about the tooltip width and behaviour.

Just one possible quirk I can see – when I click to reveal the tooltip, the "Learn more" link has its accessibility outline.

image

@Dan-Q
Copy link
Contributor Author

Dan-Q commented Apr 18, 2024

Just one possible quirk I can see – when I click to reveal the tooltip, the "Learn more" link has its accessibility outline.

Yeah, I noticed that: I assumed that it was a deliberate (a11y?) choice for this component to focus the contents of the tooltip when opened. I'll double-check!

@andfinally
Copy link
Contributor

Hi @Dan-Q, just a nudge about this PR! I'm getting a webpack build error locally – I tried to rebase on trunk, but ran into several conflicts.

@Dan-Q
Copy link
Contributor Author

Dan-Q commented May 10, 2024

Hi @Dan-Q, just a nudge about this PR! I'm getting a webpack build error locally – I tried to rebase on trunk, but ran into several conflicts.

I just merged changes from trunk without any conflicts, and I'm not getting build errors. What errors are you getting @andfinally?

@Dan-Q
Copy link
Contributor Author

Dan-Q commented May 13, 2024

Ah! Found the build error. Looks like the underlying TypeScript type doesn't anticipate an actually-valid CSS declaration. Lemme fix that!

Modern browesers interpret the former as an alias of the latter, including allowing the use of 'anywhere'. But the current version of https://www.npmjs.com/package/csstype only recognises 'anywhere' as valid for overflowWrap. Switching it prevents compilation errors, still exhibits the correct behavior.
Copy link
Contributor

github-actions bot commented May 13, 2024

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

@Dan-Q Dan-Q requested a review from andfinally May 13, 2024 09:16
@Dan-Q
Copy link
Contributor Author

Dan-Q commented May 13, 2024

Okay @andfinally! Try that now!

Copy link
Contributor

@andfinally andfinally left a comment

Choose a reason for hiding this comment

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

Thanks, works as expected!

I'm still getting the horrible outline I mentioned in #46229 (review). It's coming from a WordPress rule on all links in common.css.

I'd suggest we override it.

Index: plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss
--- a/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss	(revision d627bcdcd532e1f0a34469b9f03f5a6411832c6c)
+++ b/plugins/woocommerce-admin/client/marketplace/components/my-subscriptions/my-subscriptions.scss	(date 1715767787120)
@@ -198,6 +198,10 @@
 		color: $gray-900;
 		a {
 			text-decoration: none;
+
+			&:focus {
+				box-shadow: none;
+			}
 		}
 	}
 }

I'd even argue StatusPopover needs a pointer cursor, as it's interactive.

@Dan-Q
Copy link
Contributor Author

Dan-Q commented May 17, 2024

I'm still getting the horrible outline I mentioned in #46229 (review). It's coming from a WordPress rule on all links in common.css.

I'd suggest we override it.

If we override it in the way you suggest, it's bad for a11y. Instead, how about we just don't focus-within the popover when it appears? [2a36975] Then the link still gets a focus state when it's focussed, but not just when the popup appears.

Screen.Recording.2024-05-17.at.12.36.26.mov

@andfinally
Copy link
Contributor

andfinally commented May 17, 2024

I'm confused why we're highlighting the link if the focus is on its parent. And half of me thinks we focus on the tooltip by deafult for accessibility reasons – for example to make it easier to tab through to any link inside it. But this looks like an easy change that resolves the focus issue, thanks!

@Dan-Q
Copy link
Contributor Author

Dan-Q commented May 17, 2024

I'm confused why we're highlighting the link if the focus is on its parent.

It looks like the default behaviour for a <Popover> is to focus on the first focussable target within it, to make keyboard navigation easier if e.g. you're popping up a toolbar.

@Dan-Q Dan-Q merged commit edc22bc into trunk May 17, 2024
23 of 24 checks passed
@Dan-Q Dan-Q deleted the add/wccom19063-in-app-shared-by-badge branch May 17, 2024 12:22
@github-actions github-actions bot added this to the 9.0.0 milestone May 17, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: analysis Indicates if the PR requires a PR testing scrub session. plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants