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

(new) Improve the upsell button caret icon position in RTL languages #11398

Merged
merged 12 commits into from
Oct 31, 2018

Conversation

afercia
Copy link
Contributor

@afercia afercia commented Oct 24, 2018

Summary

This PR can be summarized in the following changelog entry:

  • N/A

Relevant technical choices:

  • introduces a new (left) caret icon
  • instead of using background images directly on the button, use the image as background of an inline <span> element so it behaves like inline content
  • refactors the CSS to use inline-flex so the text and the icon are better aligned vertically
  • the upsell button can now be used also without an icon (if necessary) so it's better reusable
  • reuses the yoast-button-upsell also in the Extensions page
  • adds the "new tab message" to all links that open in a new tab in the extensions page
  • incorporates the line-height fix from Fix upsell button line height #11334

Test instructions

The upsell button needs to be checked everywhere it appears, and also in the responsive view. As far as I know, it is used:

  • in the notice when trashing a published post
  • in the Help Center > Get support
  • in the sidebar in the admin pages
  • at the bottom of the admin pages: the upsell block
  • in the extensions page (SEO > Premium) also known as "licenses" page wp-admin/admin.php?page=wpseo_licenses
  • Additional keywords upsell modal
  • Additional keywords upsell section
  • Synonyms upsell modal

All these places need to be tested in LTR and RTL.

Example screenshot:

screen shot 2018-10-18 at 15 51 44

Fixes #11174

Copy link
Contributor

@andizer andizer left a comment

Choose a reason for hiding this comment

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

CR done. Found two minor things.

@@ -77,8 +77,10 @@ public function get_premium_message( $popup = true ) {
$assets_uri = trailingslashit( plugin_dir_url( WPSEO_FILE ) );

/* translators: %s expands to Yoast SEO Premium */
$cta_text = sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
$classes = '';
$cta_text = sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
Copy link
Contributor

Choose a reason for hiding this comment

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

$cta_text = sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
$classes = '';
$cta_text = sprintf( __( 'Get %s', 'wordpress-seo' ), 'Yoast SEO Premium' );
$new_tab_message = '<span class="screen-reader-text">' . __( '(Opens in a new browser tab)', 'wordpress-seo' ) . '</span>';
Copy link
Contributor

Choose a reason for hiding this comment

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

@IreneStr
Copy link
Contributor

2nd CR 👍

@IreneStr
Copy link
Contributor

IreneStr commented Oct 29, 2018

Acceptance 🚧

The vertical alignment of the caret seems off in the redirect notice:
schermafbeelding 2018-10-29 om 09 11 27

At the top on the premium page:
schermafbeelding 2018-10-29 om 09 18 46

In the admin (both places):
schermafbeelding 2018-10-29 om 09 30 08

schermafbeelding 2018-10-29 om 09 19 21

But the alignment looks fine in the extension 'cards':
schermafbeelding 2018-10-29 om 09 20 27

This button is a little strange (might be preexisting):
schermafbeelding 2018-10-29 om 09 14 29

The same for the button in the help center in responsive mode (might be preexisting):
schermafbeelding 2018-10-29 om 10 30 54

This might be preexisting, but in responsive mode (more specific iPhone 5/SE), this button overlaps the text:
schermafbeelding 2018-10-29 om 10 27 27

The caret has gone missing in the:

  • Additional keywords upsell modal

schermafbeelding 2018-10-29 om 09 27 55

  • Additional keywords upsell section

schermafbeelding 2018-10-29 om 09 28 43

  • Synonyms upsell modal

schermafbeelding 2018-10-29 om 09 27 47

  • All RTL-related things look good 👌

@IreneStr
Copy link
Contributor

@afercia There are three more places:

  • Additional keywords upsell modal
  • Additional keywords upsell section
  • Synonyms upsell modal

I've added them to your PR description

@afercia
Copy link
Contributor Author

afercia commented Oct 29, 2018

Added the missing caret in the UpsellBox component button. However, I can't reproduce the misalignments screenshot'd above. A couple examples of what I see on Chrome 70:

screen shot 2018-10-29 at 10 19 21

screen shot 2018-10-29 at 11 19 38

@afercia
Copy link
Contributor Author

afercia commented Oct 29, 2018

Comparing side by side what my screenshots and the ones from @IreneStr I see the actual font used is different. It's very evident especially for some letters, see for example the shape of s, e, a below:

screen shot 2018-10-29 at 11 19 38

This seems to be caused by the font stack used on the button:
font-family: "Open Sans", Arial, sans-serif;

@IreneStr do you have any "Open Sans" or "Arial" fonts installed in your system fonts? On macOS you can check the fonts in the "Font Book" app.

I think the only thing we can try is to mitigate the problem tweaking the line-height.

@afercia
Copy link
Contributor Author

afercia commented Oct 29, 2018

Aside: why are we using font-family: "Open Sans", Arial, sans-serif;?

@afercia
Copy link
Contributor Author

afercia commented Oct 29, 2018

I've installed in my system fonts Open Sans from Google fonts and I can reproduce the misalignment now. Hard to fix. The root issue is we're using a font that is not installed by default on maOS nor Windows. (not sure about *nix distros).

@afercia
Copy link
Contributor Author

afercia commented Oct 29, 2018

I've committed a temporary fix to not use "Open Sans" on the Upsell button. We should consider to remove any non-default-system-font, will create a new issue.

@Dieterrr
Copy link
Contributor

CR done 👍. I agree we need a separate issue to have a more consistent approach to the use of fonts. I am not sure removing a troublesome font is the best solution.
What I do understand from the design department is that "Open Sans" was choses because it's look is close to the system fonts of both Mac and Windows. On the Yoast website it is included. I do not know why it is not included in the plugin.
Acceptance: The caret is no longer missing in Additional keywords upsell modal,
Additional keywords upsell section, Synonyms upsell modal & Synonyms upsell section.
However, in the modal and in the "cards" the alignment is still off, now it looks a bit too far down:

screenshot 2018-10-29 16 28 48

Scientific proof:
screenshot-2018-10-29-16 12 36

Also, although I'm not sure if this is part of the issue, the button can still overlap with the text:
screenshot 2018-10-29 16 29 03

Perhaps we should discuss this issue at the standup because I can imagine this micro-adjustment of the Caret - which behaves different on different machines - can become frustrating.

@afercia
Copy link
Contributor Author

afercia commented Oct 29, 2018

A bit of historical background can help.
WordPress used to use Open Sans. It was removed in WordPress 4.6 in favor of system fonts. See also #4582

In the plugin, the font stack that uses Open Sans comes from the inclusion of files that were originally developed for yoast.com. However, the plugin is not using Google Fonts to actually include Open Sans so these font stacks are pointless, including the one that uses Merriweather.

Additionally, they're not only pointless but they create problems when users have manually installed these fonts (for any reasons) in their system.

I've removed the 1 pixel top margin from the caret. Notice the rendering is different in Firefox, and the alignment won't look perfect. Also, the icon doesn't help because it has white space around the shape.

The button overlapping content is a pre-existing unrelated issue due to the button container implementation. I'll see what can be done.

@Dieter have you checked if you have "Open Sans" installed in your system fonts and, if so, have you uninstalled as I've recommended on Slack? In your screenshot I see the purple title has a lighter weight than expected: it should be bolder:

screen shot 2018-10-29 at 17 35 30

While your one is clearly different:

47662151-b13fe000-db9a-11e8-9a3e-7d634c7479ca

@afercia
Copy link
Contributor Author

afercia commented Oct 29, 2018

I'm boy-scouting the overlapping issue by removing the absolute positioning of the button container. That didn't take into account the case of taller buttons when their content goes in two or more lines.

The "cards" are now flex items of their container an also flex containers for their content, to the content can be layout vertically using flex-direction: column.

  • cards still have the same height when in the same row
  • buttons are pushed to the bottom as before, even if the card content is shorter
  • buttons with two or more lines of text don't overlap any longer
  • also fixes the buttons min-height hack for IE11, that never worked

Screenshot with an intentionally exaggerated edge case:

screen shot 2018-10-29 at 18 08 41

@IreneStr
Copy link
Contributor

CR done 👍
The font-related things will be addressed in a separate issue.

@abotteram
Copy link
Contributor

Acceptance 👍

@abotteram abotteram merged commit 9c97a74 into trunk Oct 31, 2018
@abotteram abotteram deleted the 11174-upsell-button-caret-icon-rtl-new branch October 31, 2018 08:33
@abotteram abotteram added this to the 9.2 milestone Oct 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upsell button caret position make less sense in RTL languages
5 participants