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

Custom Fields option: Add confirmation step #15688

Merged
merged 12 commits into from
Aug 6, 2019

Conversation

marekhrabe
Copy link
Contributor

@marekhrabe marekhrabe commented May 16, 2019

Fixes #15320.

"Custom Fields" in Options modal requires a full page reload in order to toggle the option. Currently, this happens instantly after clicking the checkbox.

This PR changes the flow to add an inline confirmation step:

see the latest version #15688 (comment)

@marekhrabe marekhrabe force-pushed the try/custom-fields-toggle-deferred branch from ff0a5a3 to 77d3e11 Compare May 25, 2019 11:17
@marekhrabe marekhrabe changed the title Custom Field check box - try using DeferredOption Custom Field check box - try using confirmation button May 25, 2019
@marekhrabe
Copy link
Contributor Author

Update:

This PR shows additional message about a reload and a confirmation button to proceed. This additional UI only shows when a reload action is required and disappears when you change your mind and toggle the option back without a confirmation. It is additionally announced with spoken messages to differentiate the tickbox from all others which save options instantly.

It's not well styled and polished at this point. Let's figure out a proper interaction first.

Question: Do spoken messages make sense here? If so, what would their formulations be? I'm sure I haven't came up with the most ideal copy.

If we confirm this approach is a way forward, I can take a look at styling, making string translatable etc…

@nerrad nerrad added [Type] Enhancement A suggestion for improvement. [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). [Feature] Document Settings Document settings experience and removed [Type] Enhancement A suggestion for improvement. labels May 27, 2019
@noisysocks noisysocks added Needs Accessibility Feedback Need input from accessibility Needs Design Needs design efforts. labels May 27, 2019
@noisysocks
Copy link
Member

noisysocks commented May 27, 2019

I can't answer the question about using speak(), but functionally I think this is the right approach!

I added the Needs Design label so that the design team can offer some suggestions. Personally I'd advocate for something relatively inline and unobtrusive.

Screen Shot 2019-05-27 at 11 22 06

(The link would be a <Button> with isLink.)

EDIT: @mapk shared a much nicer design in #15320 (comment).

@karmatosed karmatosed requested a review from mapk May 28, 2019 15:09
@mapk
Copy link
Contributor

mapk commented May 29, 2019

Oh dang, turns out I added a redesign to the issue and not the PR. In case people don't want to click around, here's the proposed redesign.

Screen Shot 2019-05-28 at 6 58 44 PM

I'm not entirely sure if the notification should be blue or yellow. Any thoughts on that?

@mapk mapk added Needs Design Feedback Needs general design feedback. and removed Needs Design Needs design efforts. labels May 29, 2019
@mapk
Copy link
Contributor

mapk commented May 29, 2019

Okay, because this is more of a warning notification, let's go with a yellow version.

Screen Shot 2019-05-29 at 10 07 20 AM

@afercia
Copy link
Contributor

afercia commented Jun 7, 2019

Discussed during today's accessibility bug scrub. Quick feedback: if there’s text with relevant information and if the button says “Save and Reload” there’s no need for a spoken message.

@afercia afercia removed the Needs Accessibility Feedback Need input from accessibility label Jun 7, 2019
@noisysocks noisysocks self-assigned this Jul 4, 2019
@noisysocks noisysocks force-pushed the try/custom-fields-toggle-deferred branch from 77d3e11 to a51bf94 Compare July 5, 2019 02:40
@talldan
Copy link
Contributor

talldan commented Jul 25, 2019

Agree that adjusting the wording would be a good compromise to get this merged. I like @marekhrabe's suggestions in the comment above, or just shortening it to 'Reload' / 'Reload now'.

Could it also be worth adding something to the main part of the message? e.g. 'A page reload is required for this change, please save any changes to your content before reloading.'

@mapk
Copy link
Contributor

mapk commented Jul 26, 2019

"Enable & Reload" or "Disable & Reload"

Oh, I missed these. I prefer them over my suggestions. Thanks!

Could it also be worth adding something to the main part of the message? e.g. 'A page reload is required for this change, please save any changes to your content before reloading.'

If handling the save of the document automatically before reloading gets tricky, this seems like the right solution. And if they miss that text and trigger the reload anyways, alerting them with an "Are you sure" message as @marekhrabe suggested works too.

@marekhrabe
Copy link
Contributor Author

"Enable & Reload" or "Disable & Reload"

I have implemented these in 8320d22

And if they miss that text and trigger the reload anyways, alerting them with an "Are you sure" message as @marekhrabe suggested works too.

"Are you sure" functionality is done on a global level and it is already triggering for this option.

I have added an extra sentence to the info message about saved content.

Current State

Screenshot 2019-07-27 at 09 37 12

Screenshot 2019-07-27 at 09 37 01

With unsaved content:

Screenshot 2019-07-27 at 09 37 31

@gziolo gziolo removed this from the Gutenberg 6.2 milestone Jul 30, 2019
@marekhrabe
Copy link
Contributor Author

All tests now account for new labels. Are we good to go with this state #15688 (comment)?

@marekhrabe marekhrabe requested a review from talldan August 1, 2019 00:02
Copy link
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

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

The code changes look good, and this tests well. Thanks for the assist @marekhrabe!

I'll leave it for @mapk to give the final say on whether the design and copy are ready to be merged.

marekhrabe and others added 2 commits July 31, 2019 21:01
Co-Authored-By: Robert Anderson <robert@noisysocks.com>
@mapk
Copy link
Contributor

mapk commented Aug 6, 2019

I gave it another go. The added sentence looks great! Thanks everyone for helping out with this one. :shipit:

Copy link
Contributor

@mapk mapk left a comment

Choose a reason for hiding this comment

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

:shipit: Looks good!

@marekhrabe marekhrabe added this to the Gutenberg 6.3 milestone Aug 6, 2019
@marekhrabe
Copy link
Contributor Author

This PR has truly been a journey 😀Thanks everybody!

@marekhrabe marekhrabe merged commit c5d573a into master Aug 6, 2019
@marekhrabe marekhrabe deleted the try/custom-fields-toggle-deferred branch August 6, 2019 04:29
gziolo pushed a commit that referenced this pull request Aug 29, 2019
* Add confirmation step to Custom Fields option

Add a confirmation step to the Custom Fields option so that the page
doesn't reload without warning.

Co-authored-by: Marek Hrabe <marekhrabe@me.com>

* Update E2E tests for new Custom Fields setting flow

* Remove notice in favor of plain text.

* Custom Fields option: Adjust margin to align text

* update description

Co-Authored-By: Daniel Richards <daniel.richards@automattic.com>

* simplify change handler

* add dynamic button based on the next state to be saved

* add notice about saved content and make sure it won't expand modal

* update snapshot with new button label and confirm msg

* make button label in test dynamic

* simplify condition for determining label

Co-Authored-By: Robert Anderson <robert@noisysocks.com>

* use willEnable as the prop name
gziolo pushed a commit that referenced this pull request Aug 29, 2019
* Add confirmation step to Custom Fields option

Add a confirmation step to the Custom Fields option so that the page
doesn't reload without warning.

Co-authored-by: Marek Hrabe <marekhrabe@me.com>

* Update E2E tests for new Custom Fields setting flow

* Remove notice in favor of plain text.

* Custom Fields option: Adjust margin to align text

* update description

Co-Authored-By: Daniel Richards <daniel.richards@automattic.com>

* simplify change handler

* add dynamic button based on the next state to be saved

* add notice about saved content and make sure it won't expand modal

* update snapshot with new button label and confirm msg

* make button label in test dynamic

* simplify condition for determining label

Co-Authored-By: Robert Anderson <robert@noisysocks.com>

* use willEnable as the prop name
@marekhrabe
Copy link
Contributor Author

I just saw this featured as one of the tips about Gutenberg on Twitter 😀

https://twitter.com/editorskit/status/1178693225923497984

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Document Settings Document settings experience [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom field check box automatically changes the context on user focus
8 participants