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

fix issue 24539, show external icon on help button #24622

Merged
merged 3 commits into from
Sep 8, 2020
Merged

fix issue 24539, show external icon on help button #24622

merged 3 commits into from
Sep 8, 2020

Conversation

leutrimhusaj
Copy link
Contributor

@leutrimhusaj leutrimhusaj commented Aug 18, 2020

Description

I have added the external icon (icon={ external }) to the Help MenuItem for edit-post and edit-site plugin. Adding as an svg was important because when i referenced it only as a string (icon="external") it creates a Dashicon, which is 20x20 pixel big, it would break the padding of the text. The default icon size is 24x24 pixel and fits perfect into the more option menu.

How has this been tested?

Open gutenberg editor for a page.
Open the "more option" menu and check/click the help button.

Screenshots

help-with-external-icon

Types of changes

Bug fix for #24539 with non-breaking change

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@youknowriad youknowriad added the Needs Design Feedback Needs general design feedback. label Aug 19, 2020
@jasmussen
Copy link
Contributor

Thank you for the PR! This tests nicely, the code is clean and simple, and it solves the issue. The placement on the left feels a little off to me, though, and it might feel better if the icon immediately followed the link, inline in the text. We might even discuss making external a prop on menu items, so this gets simplified.

However because of the simplicity of this PR, and the issue it solves, I'm not opposed to approving this as an interim solution. I also still have a PR in progress (#23552#issuecomment-656049689) which would refactor some of this stuff, so it will be revisited.

I'd love a quick sanity check, @shaunandrews or @MichaelArestad in case you have them?

Thanks again!

@MichaelArestad
Copy link
Contributor

@jasmussen It works well enough until it gets revisited. I believe I share your concern over the location of the icon. Right now it draws extra intention due to the way it aligns with other items on the list. If there's anything I can do to help your PR along, let me know.

@@ -38,6 +39,7 @@ registerPlugin( 'edit-post', {
<CopyContentMenuItem />
<MenuItem
role="menuitem"
icon={ external }
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks so much for picking this up 👍

In addition to the icon, the other thing that's usually present on these external links is some visually hidden text for screenreader users.

I think you should be able to follow how the External Link component does that for implementing it on these two MenuItems:
https://github.com/WordPress/gutenberg/blob/master/packages/components/src/external-link/index.js#L38-L43

Alternatively, as @jasmussen proposes a prop for the MenuItem component could be an option so that it adds the icon and the visually hidden text implicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the hint, i didn't knew about that. I have added the visually hidden text like in the example, works well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@talldan I thought about the alternative idea from @jasmussen and prepared another PR #24713 with the enhancement of the MenuItem. Maybe you could check if this is a better solution?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll refresh my PRs and rebase them off whatever lands here. In the mean time, this PR should not be held up.

This is what the preview dropdown looks like:

Screenshot 2020-08-24 at 09 50 02

The same feedback applies to that, it looks a little weird on the left. But because this PR looks the same, I say let's move this forward. 👍 👍 from a design POV and thank you for the PR! If this gets a quick sanity check, we should land it.

@talldan talldan added First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). General Interface Parts of the UI which don't fall neatly under other labels. labels Aug 20, 2020
@shaunandrews
Copy link
Contributor

I find it a little weird, both visually (it feels unbalanced) and conceptually (the left-side space is usually reserved for the checkmark). I think it'd be better placed inline, to the right of the text, but I don't have a strong preference.

I think an ideal solution is to not open an external link directly from the menu. Instead, I'd expect a help modal to appear within the editor — and from that modal, I'd find general guidance along with links to external resources.

@jasmussen
Copy link
Contributor

I have refreshed #23552, which now shows at least the preview icon on the right:

Screenshot 2020-08-28 at 11 33 51

If that PR lands first, rebasing this one should address the most pressing feedback about the icon positioning. That does not preclude a further PR that changes that link to open a modal dialog instead — totally fair feedback — but until that, this one would be a nice little improvement.

@shaunandrews
Copy link
Contributor

👍

@leutrimhusaj
Copy link
Contributor Author

I have rebased the PR and fixed the conflicts. This PR looks like this now.

help-with-external-icon-right

@jasmussen @talldan Is there anything else to do for this minimal PR?

The other feature should be done in other PR in my opinion.

Copy link
Contributor

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

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

This seems like a good small win. Thanks for the PR!

Before:

Screenshot 2020-09-08 at 11 11 08

After:

Screenshot 2020-09-08 at 11 15 23

Markup:

Screenshot 2020-09-08 at 11 15 33

@jasmussen jasmussen merged commit 149849e into WordPress:master Sep 8, 2020
@github-actions
Copy link

github-actions bot commented Sep 8, 2020

Congratulations on your first merged pull request, @leutrimhusaj! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 9.0 milestone Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). General Interface Parts of the UI which don't fall neatly under other labels. Needs Design Feedback Needs general design feedback. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Help link in the editor 'more' menu doesn't indicate that it opens in a new tab
6 participants