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

Site Editor: Update save panel's cancel button from icon to visible text #37310

Conversation

jonahtanjz
Copy link
Contributor

@jonahtanjz jonahtanjz commented Dec 12, 2021

Description

Resolves #29886

The current save panel for site editor uses an X icon to close the panel. This is inconsistent with the post editor's cancel button. This PR updates the save panel's cancel button of site editor from the X icon to the cancel button with text, similar to post editor's button.

How has this been tested?

  1. Open up site editor
  2. Make any changes to the page
  3. Click on the "Save" button to open up the save panel
  4. The save and cancel buttons should be consistent with the design of the post editor panel's buttons

Screenshots

Before After
image image

Types of changes

Enhancement

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • 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 (please manually search all *.native.js files for terms that need renaming or removal).

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Dec 12, 2021
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @jonahtanjz! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@jonahtanjz jonahtanjz marked this pull request as ready for review December 12, 2021 04:38
@ntsekouras ntsekouras added the Needs Design Feedback Needs general design feedback. label Dec 13, 2021
Copy link
Member

@kevin940726 kevin940726 left a comment

Choose a reason for hiding this comment

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

Thank you for making this PR! Code looks good and works as expected!

However, we could further tidy this up using <Flex>, <FlexItem> and gap. The JSX would look something like:

<Flex className="entities-saved-states__panel-header" gap={ 2 }>
  <FlexItem
    isBlock
    as={ Button }
    { ...otherProps }
  >
    { __( 'Save' ) }
  </FlexItem>
  <FlexItem
    isBlock
    as={ Button }
    { ...otherProps }
  >
    { __( 'Cancel' ) }
  </FlexItem>
</Flex>

Then, we can delete all those custom CSS:

 .entities-saved-states__panel-header {
   /* Other styles... */
-  display: flex;
-  align-items: center;
-  align-content: space-between;
-
-  .components-button {
-    flex-grow: 1;
-    justify-content: center;
-    margin: auto;
-  }
-
-  .editor-entities-saved-states__cancel-button {
-    margin-left: 4px;
-  }
-
-  .editor-entities-saved-states__save-button {
-    margin-right: 4px;
-  }
 }

This could be a follow-up though 👍 .

onClick={ dismissPanel }
label={ __( 'Close panel' ) }
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should keep this explicit label indicating that it's closing the panel. Could use some inputs from accessibility folks. WFYT @tellthemachines ?

@jonahtanjz jonahtanjz force-pushed the update/site-editor-save-panel-cancel-button branch from f205f16 to 1dce8be Compare December 15, 2021 17:27
@jonahtanjz
Copy link
Contributor Author

@kevin940726 Thanks for the review and suggestion! Since I'm already on this, I've changed it to use <Flex> and <FlexItem>, and also removed the custom CSS :)

Copy link
Member

@kevin940726 kevin940726 left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you ♥️ !

@jonahtanjz jonahtanjz force-pushed the update/site-editor-save-panel-cancel-button branch from 3dd7bb9 to de66594 Compare December 16, 2021 05:59
@jonahtanjz jonahtanjz force-pushed the update/site-editor-save-panel-cancel-button branch from 7be5b83 to 7b497b7 Compare December 16, 2021 06:40
@kevin940726 kevin940726 merged commit 3044e2f into WordPress:trunk Dec 16, 2021
@github-actions
Copy link

Congratulations on your first merged pull request, @jonahtanjz! 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 12.3 milestone Dec 16, 2021
@jeffpaul
Copy link
Member

@jonahtanjz any chance you could confirm your WordPress.org account so that we can properly credit you in next week's WordPress 6.0 release?

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 Needs Design Feedback Needs general design feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site editor save panel: -Use a cancel button with visible text
4 participants