Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#47487 closed enhancement (fixed)

Classic Editor plugin link and link target

Reported by: derweili's profile derweili Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.3 Priority: normal
Severity: normal Version: 5.2.1
Component: Editor Keywords: has-patch commit
Focuses: accessibility Cc:

Description

The Editor shows following warning when JavaScript is disabled:
The block editor requires JavaScript. Please enable JavaScript in your browser settings, or try the Classic Editor plugin.

The "Classic Editor plugin" texts links to the classic editor in the Plugin repository. If you click on the link you will be redirected to the plugin respository and will leave the WordPress admin without any warning.

To reproduce
Steps to reproduce the behavior:

  1. Disable Javascipt
  2. Create a post
  3. See the message
  4. Click on "Classic Editor plugin"

Expected behavior
I wouldn't expect to leave the admin area without any warning.

There are two alternative behaviors I could think of:

  1. The link opens in a new window/tab.

Therefore we need to add target="_blank" to the link.

  1. Instead of linking to the respository, we could link to the plugin-install.php with the classic editor pre-selected. (if this is possible)

Attachments (6)

47487.diff (767 bytes) - added by derweili 5 years ago.
Open classic editor link in new window/tab
47487.2.diff (934 bytes) - added by garrett-eclipse 5 years ago.
Replace external Classic Editor plugin link w/ internal Plugin Install URL for when JS disabled on block editor
Screen Shot 2019-06-07 at 10.23.27 AM.png (42.7 KB) - added by garrett-eclipse 5 years ago.
Notice w/ updated link
Screen Shot 2019-06-07 at 10.23.22 AM.png (211.0 KB) - added by garrett-eclipse 5 years ago.
Internal Classic Editor plugin install page
47487.3.diff (810 bytes) - added by garrett-eclipse 5 years ago.
Fix CS & improve translator comment
47487.4.diff (1.8 KB) - added by garrett-eclipse 5 years ago.
Update to wp-admin/includes/template.php in do_block_editor_incompatible_meta_box where same type of install URL is present.

Download all attachments as: .zip

Change History (13)

@derweili
5 years ago

Open classic editor link in new window/tab

#1 @derweili
5 years ago

  • Keywords has-patch added

#2 in reply to: ↑ description @SergeyBiryukov
5 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from Awaiting Review to Future Release

Hi @derweili, welcome to WordPress Trac! Thanks for the report.

Instead of linking to the respository, we could link to the plugin-install.php with the classic editor pre-selected. (if this is possible)

This would be the preferred option here. It was previously done in [43946] an [43952] for 5.0 About page (some comments on #45178 have more details, starting with comment:42:ticket:45178).

Forcing links to open in a new tab should be avoided for accessibility reasons:

Avoid target="_blank" in your links. It can be confusing to all types of users, especially for visually impaired folks. They can wind up with all sorts of open tabs that they don’t even know about. Leave the control of whether the link opens in the same window or in another tab in the hands of users.

Related: #23432

@garrett-eclipse
5 years ago

Replace external Classic Editor plugin link w/ internal Plugin Install URL for when JS disabled on block editor

@garrett-eclipse
5 years ago

Notice w/ updated link

@garrett-eclipse
5 years ago

Internal Classic Editor plugin install page

#3 @garrett-eclipse
5 years ago

  • Focuses accessibility added
  • Keywords has-patch needs-testing added; needs-patch removed
  • Milestone changed from Future Release to 5.3

Thanks for flagging this @derweili and for the initial patch, made it easy to find what link you were referring to.

@SergeyBiryukov I appreciate the input and direction, I've pulled the internal install link which was committed here;
https://core.trac.wordpress.org/changeset/44264

This links to the custom install screen made for the Classic Editor plugin. For reference here's the link code;
esc_url( wp_nonce_url( self_admin_url( 'plugin-install.php?tab=favorites&user=wordpressdotorg&save=0' ), 'save_wporg_username_' . get_current_user_id() ) )

My patch 47487.2.diff implements this URL replacing the translatable external plugin link.

This loads the custom favorites tab of the plugin install screen for the wordpressdotorg user which is specifically favourited Classic Editor, also has nonce to restore the users favorites.

Sergey can you review the link setup for CS I wasn't sure since it was inside an expanded sprintf if the esc_url, wp_nonce_url and self_admin_url calls should all be on individual lines indented or if the shortform I'm using passes formatting.

Please test,
Thank you

#4 @afercia
5 years ago

  • Keywords needs-testing removed

Thanks for working on this. Quickly tested and the esc_url ... in one line is OK. Instead, phpcs complains for the closing ?> and asks for one more tab. Which doesn't make sense to me, but this is the current state of the CS rules 🤷🏻‍♂️

I'd consider to improve the translators comment.

@garrett-eclipse
5 years ago

Fix CS & improve translator comment

@garrett-eclipse
5 years ago

Update to wp-admin/includes/template.php in do_block_editor_incompatible_meta_box where same type of install URL is present.

#5 @garrett-eclipse
5 years ago

  • Keywords needs-testing added

Thanks @afercia I've fixed the CS rule and improved the translator comment in 47487.3.diff.

I also found another similar implementation in wp-admin/includes/template.php for do_block_editor_incompatible_meta_box which I've uploaded 47487.4.diff to address.

I appreciate the review and testing.

#6 @afercia
5 years ago

  • Keywords commit added; needs-testing removed
  • Owner set to SergeyBiryukov
  • Status changed from new to assigned

Thanks! The patch looks good to me, assigning to @SergeyBiryukov for a final review :)

#7 @SergeyBiryukov
5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 45657:

Editor: Replace external Classic Editor plugin URL with a link to Add Plugins screen with Classic Editor pre-selected.

This applies to messages displayed when JavaScript is disabled in Block Editor, or an incompatible meta box is used.

Props garrett-eclipse, derweili, afercia.
Fixes #47487.

Note: See TracTickets for help on using tickets.