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

Enable ESC and clicking background to close full screen dialog #8697

Merged
merged 9 commits into from
Feb 1, 2018

Conversation

gravityrail
Copy link
Contributor

@gravityrail gravityrail commented Jan 31, 2018

Fixes #7904

Changes proposed in this Pull Request:

  • Clicking the background or pressing the ESC key should close full screen dialogs
  • Move close button into the dialog body.

close-button-moved

Testing instructions:

  • Trigger a full-screen dialog. This code snippet in a micro-plugin will do the trick for forcing an upgrade prompt on any of the Jetpack dash/settings pages:
add_action( 'plugins_loaded', function() {
    Jetpack::state( 'message', 'modules_activated' );
});
  • Click the background, the dialog should be closed
  • Click the foreground (main part of dialog or picture above it) - the dialog should NOT be closed
  • Re-open the dialog (e.g. by re-loading). Hit the ESC key. The dialog should be closed.

This also moves the close button into the top-right corner of the dialog, and includes an updated gridicons file which includes the circular close icon. Other uses of gridicons should be re-tested to ensure I didn't break anything.

Proposed changelog entry for your changes:

Better usability for full-screen dialogs.

@gravityrail gravityrail requested a review from a team as a code owner January 31, 2018 21:14
@gravityrail gravityrail self-assigned this Jan 31, 2018
@gravityrail gravityrail added [Type] Bug When a feature is broken and / or not performing as intended [Focus] Accessibility Improving usability for all users (a11y) labels Jan 31, 2018
@gravityrail gravityrail added this to the 5.8 milestone Jan 31, 2018

// capture the ESC key globally
componentDidMount(){
document.addEventListener('keydown', this.props.dismiss, false);
Copy link
Member

Choose a reason for hiding this comment

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

I think these new rules should respect this.props.showDismiss -- there may be instances we don't want to allow dismissal without action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea - fixed

Copy link
Member

Choose a reason for hiding this comment

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

git push? While you're in there can you apply code standard spacing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@gravityrail gravityrail added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. [Status] Needs Design Review Design has been added. Needs a review! labels Jan 31, 2018
@dereksmart
Copy link
Member

esc is throwing a console error with the recent changes

@dereksmart
Copy link
Member

Is the update to the gridicon library necessary for this change? I think it will require some more testing. These changes now are modifying existing styles, example:

screen shot 2018-01-31 at 5 10 36 pm

@dereksmart
Copy link
Member

yarn lint is throwing some a11y errors causing the tests to fail

screen shot 2018-01-31 at 5 14 12 pm

@joanrho
Copy link
Contributor

joanrho commented Jan 31, 2018

@gravityrail can you replace the "cross-circle" Gridicon with either the "cross" or "cross-small" instead?

Here's a screenshot of what the "cross-small" could look like there:

screen shot 2018-01-31 at 3 31 52 pm

@gravityrail
Copy link
Contributor Author

@joanrho - icon updated, and screenshot in description

@dereksmart - feedback addressed, going to dismiss your review so you can take another look :)

@joanrho joanrho added [Status] Design Review Complete and removed [Status] Needs Design Review Design has been added. Needs a review! labels Jan 31, 2018
@joanrho
Copy link
Contributor

joanrho commented Jan 31, 2018

Design review approved. Thanks for the edits, Dan!

Copy link
Member

@dereksmart dereksmart left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@zinigor zinigor left a comment

Choose a reason for hiding this comment

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

Made one small change to remove bind calls from properties, otherwise LGTM whenever Travis finishes!

@zinigor zinigor added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Feb 1, 2018
@zinigor zinigor merged commit 4a3ad0d into master Feb 1, 2018
@zinigor zinigor removed the [Status] Ready to Merge Go ahead, you can push that green button! label Feb 1, 2018
@zinigor zinigor deleted the fix/better-dialog-close-ux branch February 1, 2018 19:42
zinigor pushed a commit that referenced this pull request Feb 1, 2018
* Enable ESC and clicking background to close full screen dialog

* Update gridicons and reposition close button on dialog

* Better spacing

* Only import the one gridicon we need

* Revert unnecessary changes to gridicons

* Fix JS error due to unbound handler

* Fix event binding and restrict to ESC code

* Fix eslint error

* Removed bind calls from property assignments.
@zinigor
Copy link
Member

zinigor commented Feb 1, 2018

Ported to branch-5.8 in 36b4d68.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility Improving usability for all users (a11y) [Pri] BLOCKER [Status] Design Review Complete [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admin Page: no option to dismiss Warm Welcome
6 participants