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

Editor: Resolve Publish button busy state styling regression #16303

Merged
merged 5 commits into from
Jul 3, 2019

Conversation

aduth
Copy link
Member

@aduth aduth commented Jun 26, 2019

Fixes #15029

This pull request seeks to resolve an issue where the Publish button (or any busy, disabled button) would display with incorrect styling.

Before After
Before After

Implementation Notes:

There are two separate changes which independently resolve the issue, but which together help reduce redundancy and assure broader applicability:

  • A button should not be assigned is-default styling if it is is a primary button, since the "default" styling is the gray background (which primary styling is intended to supersede)
  • The publish button does not need large styling (which is how is-default was applied) because all style properties of is-large (source) are substituted in post editor header styles ([1], [2]). This also ensures consistency with the "Toggle" variant of the same button, which already doesn't apply isLarge and, aside from text of the button is intended to appear visually identical.

Testing Instructions:

Verify that upon Publishing a post, the intermediate state of the save request displays as shown in the "After" screenshot above.

@aduth aduth added [Type] Bug An existing feature does not function as intended [Feature] UI Components Impacts or related to the UI component system [Component] Button [Feature] Saving Related to saving functionality labels Jun 26, 2019
@@ -28,7 +28,7 @@ export function Button( props, ref ) {

const classes = classnames( 'components-button', className, {
'is-button': isDefault || isPrimary || isLarge || isSmall,
'is-default': isDefault || isLarge || isSmall,
'is-default': ! isPrimary && ( isDefault || isLarge || isSmall ),
Copy link
Member

Choose a reason for hiding this comment

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

Would the condition isDefault || ! isPrimary && ( isLarge || isSmall )also work? I guess when someone passes isDefault there is an expectation the is-default class is added for sure. Otherwise, maybe we can add a small note on https://github.com/WordPress/gutenberg//blob/dd9bf47ff07680d672efc5b31abac268e2cb69c0/packages/components/src/button/README.md#L128 saying the prop is ignored if isPrimary prop is also passed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, well, the root of the problem is that nobody should ever apply both isPrimary and isDefault, so your expectation may be valid in considering isDefault alone, but not in combination with isPrimary.

That being said, your suggestion still seems like a slight improvement in sensibly mapping isDefault and isPrimary to their respective classes, irrespective the styling conflict which would likely ensue from this choice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in cc9a755.

@youknowriad
Copy link
Contributor

I think the button is supposed to be animated. I'm not seeing the animation?

@youknowriad
Copy link
Contributor

nevermind, I had the "disable animations" plugin enabled :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Saving Related to saving functionality [Feature] UI Components Impacts or related to the UI component system [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Publish button styling issue
3 participants