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

Components: Add info prop support to MenuItem, FeatureToggle #10802

Merged
merged 8 commits into from
Oct 19, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Oct 19, 2018

Closes #10340

This pull request seeks to add a new info prop to the MenuItem and FeatureToggle components.

image

Testing Instructions:

Verify an extended description is shown for the More Menu Unified Toolbar button, as in the screenshot above:

Notable variations:

  • Checked, unchecked
  • Cross-browser

Ensure unit tests pass:

npm run test-unit

@aduth aduth added [Status] In Progress Tracking issues with work in progress Needs Design Feedback Needs general design feedback. Needs Accessibility Feedback Need input from accessibility labels Oct 19, 2018
@aduth aduth added this to the 4.1 - UI freeze milestone Oct 19, 2018
@aduth aduth added [Feature] UI Components Impacts or related to the UI component system and removed [Status] In Progress Tracking issues with work in progress labels Oct 19, 2018

// Don't wrap text until viewport is beyond the mobile breakpoint.
Copy link
Member Author

Choose a reason for hiding this comment

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

This change directly undoes the intention of #8756.

Guess it depends if we'd rather:

Wrapped Unwrapped
Wrapped Unwrapped

Also, the comment is misleading, where the previous behavior had the opposite effect.

cc @jasmussen @tofumatt

Copy link
Member

Choose a reason for hiding this comment

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

@alexislloyd thoughts on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe worth noting currently there is a max-width of the menu (480px), after which the text simply becomes clipped.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

I think wrapped is better here, as long as we're careful not to have the descriptions go over two lines with standard font sizes.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also ok with editing down the first description to "Access all tools in one place"

Copy link
Member Author

@aduth aduth Oct 19, 2018

Choose a reason for hiding this comment

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

We also have the option to enforce a max-width (with wrapping) on the description specifically, allowing both the main label and shortcut text grow unrestrained.

Edit Actually, this might not work so well, or at least it leaves the possibility that the description is prematurely wrapped when the button has a long primary label.

} else {
await page.click( '.edit-post-more-menu button' );
}
const toggleFixedToolbar = async ( isFixed ) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -41,7 +41,7 @@ class IconButton extends Component {
);

let element = (
<Button { ...additionalProps } aria-label={ label } className={ classes }>
<Button aria-label={ label } { ...additionalProps } className={ classes }>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you just use the label prop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what you mean by "use". Button doesn't have a label prop.

- Type: `string`
- Required: No

Refer to documentation for [Shortcut's `shortcut` prop](../shortcut/README.md#shortcut).
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the detailed README here 👍

@youknowriad
Copy link
Contributor

Design questions

  • Can't we leave the shortcuts there somehow?
  • Can we reduce the "opacity" or change a little bit the color of the description (to separate it more clearly from the title) (I think opacity: 0.84; is the minimum opacity to be accessible)

@youknowriad
Copy link
Contributor

Code wise, this look good 👍

@aduth
Copy link
Member Author

aduth commented Oct 19, 2018

Can't we leave the shortcuts there somehow?

Which shortcuts?

Can we reduce the "opacity" or change a little bit the color of the description

We already have two other variations of a descriptive subtext, one in the Post Visibility menu, the other of sidebar Controls (e.g. Drop Cap description). As implemented here, I've inherited precisely the style used for the sidebar controls (as proposed at #10340 (comment) and seconded at #10340 (comment)).

Now, that being said, I kinda agree with you 😄 But I didn't want to go ahead and add a third variation of what amounts to the same usage.

@youknowriad
Copy link
Contributor

@aduth I was confused, just noticed these modes don't have shortcuts, I thought they had.

@youknowriad
Copy link
Contributor

I think it was suggested elsewhere but maybe the solution here is to darken the default color of the links instead.

@youknowriad
Copy link
Contributor

I think there's a snapshot that needs updating (e2e tests)

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

LGTM 👍 (I'd appreciate a design check first though)

@youknowriad
Copy link
Contributor

cc @alexislloyd in case you have some thoughts on the design questions raised here

@alexislloyd
Copy link
Contributor

We already have two other variations of a descriptive subtext, one in the Post Visibility menu, the other of sidebar Controls (e.g. Drop Cap description). As implemented here, I've inherited precisely the style used for the sidebar controls (as proposed at #10340 (comment) and seconded at #10340 (comment)).

I think that this is an issue to resolve going forward to make sure we have consistent patterns for different type styles and usage guidelines, so that we avoid a lot of inconsistency. That's a longer-term solution though.

For a two-line list item like this, I would propose that the info prop be 2px smaller in size and slightly lighter grey (while maintaining sufficient contrast).

@youknowriad
Copy link
Contributor

screen shot 2018-10-19 at 19 37 01

Updated the PR:

  • I made the menu links a bit darker, the info lighter and decreased the font-size for the info by 1px (2px felt too small)

Thoughts?

@youknowriad youknowriad removed the Needs Design Feedback Needs general design feedback. label Oct 19, 2018
@youknowriad youknowriad merged commit e8aaada into master Oct 19, 2018
@youknowriad youknowriad deleted the add/10340-menu-item-info branch October 19, 2018 19:08
antpb pushed a commit to antpb/gutenberg that referenced this pull request Oct 26, 2018
…ress#10802)

* Components: Allow aria-label override on IconButton

* Components: Add `info` prop support to MenuItem

* Edit Post: Add `info` prop support to FeatureToggle

* Edit Post: Add feature toggle info texts

* Components: Menu Item: Break text beyond mobile toolbar

* Components: Icon Button: Indent text by SVG margin

Avoids offset indent on wrapped text

* Tweak menu item styling

* Avoid italic text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system Needs Accessibility Feedback Need input from accessibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants