Make WordPress Core

Opened 21 months ago

Closed 17 months ago

Last modified 17 months ago

#57073 closed defect (bug) (fixed)

collapse menu not working on wp-admin/theme-editor.php or wp-admin/plugin-editor.php

Reported by: itsnikhilpatel's profile itsnikhilpatel Owned by: audrasjb's profile audrasjb
Milestone: 6.2 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: javascript Cc:

Description

when i'm on wp-admin/theme-editor.php or wp-admin/plugin-editor.php and click on collapse menu somehow how it's not working and if i after that if click on any other link it automatically go to collapse menu.

below here is screenshot

Attachments (1)

abe4e721ca144fa7d99485acc6766ac7.gif (1.4 MB) - added by audrasjb 17 months ago.
After patch: bug fixed

Download all attachments as: .zip

Change History (13)

#1 @dilipbheda
21 months ago

  • Focuses javascript added
  • Keywords needs-patch added

@itsnikhilpatel Thanks for ticket.
I've reviewed this issue and I replicate this issue in my local.
Ref: https://tinyurl.com/284ju5lf

It seems issue with the DOM object here - https://github.com/WordPress/wordpress-develop/blob/trunk/src/js/_enqueues/admin/common.js#L18

document.body return null

This ticket was mentioned in PR #3630 on WordPress/wordpress-develop by @stalukder03.


20 months ago
#2

  • Keywords has-patch added; needs-patch removed

#3 @stalukder03
20 months ago

  • Keywords needs-testing added

Fixed the issue.

@stalukder03 commented on PR #3630:


20 months ago
#4

Here pushed two commits where a commit (Updated jquery migrate to version 3.4.0) was related to this ticket, https://core.trac.wordpress.org/ticket/56743

#5 @stalukder03
18 months ago

Hi @audrasjb & @adeltahri

Can you please test this ticket?

Thanks

#6 @adeltahri
18 months ago

  • Keywords needs-testing removed

Tested
On wp-admin/theme-editor.php and wp-admin/plugin-editor.php and the patch work without any issues.

https://d.pr/i/0MfnLb

#7 @audrasjb
18 months ago

  • Component changed from General to Administration
  • Milestone changed from Awaiting Review to 6.2
  • Version trunk deleted

Related: #56743.

Indeed, this tickets needs to wait for #56743 to be committed.
Then, this patch will fix the issue:

script-loader.php:
Replace

$scripts->add( 'wp-theme-plugin-editor', "/wp-admin/js/theme-plugin-editor$suffix.js", array( 'common', 'wp-util', 'wp-sanitize', 'jquery', 'jquery-ui-core', 'wp-a11y', 'underscore' ) );

with

$scripts->add( 'wp-theme-plugin-editor', "/wp-admin/js/theme-plugin-editor$suffix.js", array( 'common', 'wp-util', 'wp-sanitize', 'jquery', 'jquery-ui-core', 'wp-a11y', 'underscore' ), false, 1 );

#8 @audrasjb
18 months ago

  • Owner set to audrasjb
  • Status changed from new to reviewing

#9 @stalukder03
18 months ago

Hi @audrasjb

Fixed that dependency issue. PR updated. Now, this patch should work independently.
Please take a look.

Thanks

Last edited 18 months ago by stalukder03 (previous) (diff)

#10 @Ankit K Gupta
17 months ago

Tested this issue with the PR https://github.com/WordPress/wordpress-develop/pull/3630 and this PR fixed the issue.

Test Report

Env

Steps to test

  1. Access the WordPress Dashboard.
  2. Navigate to the 'Appearance' section.
  3. Select the 'Theme File Editor' option.
  4. Click on the 'Collapse menu' feature.

Test result

The functionality of the 'Collapse menu' feature has been rectified, and it is now operating in accordance with the desired behavior. Upon being clicked, it is observed to expand or collapse the menu as intended. Comprehensive testing was conducted on this feature, along with the examination of other menu items and the 'Plugin File Editor' tab to ensure their smooth operation.

Screencast:

Before Fix -

https://screencast-o-matic.com/watch/c0noF1Vyj0Y

After Fix by PR3630 -

https://screencast-o-matic.com/watch/c0noFQVyj0W

Actual Results

✅ Expected result- works as expected with the patch.

Last edited 17 months ago by Ankit K Gupta (previous) (diff)

@audrasjb
17 months ago

After patch: bug fixed

#11 @audrasjb
17 months ago

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

In 55410:

Administration: Move wp-theme-plugin-editor script before </body>.

This changeset moves the wp-theme-plugin-editor admin script before </body> instead of in the <head>. This fixes an issue where the collapse admin menu feature was not working in the Theme|Plugin File Editor screens.

Props itsnikhilpatel, dilipbheda, stalukder03, audrasjb, adeltahri, Ankit-K-Gupta, mahbubshovan.
Fixes #57073.

@audrasjb commented on PR #3630:


17 months ago
#12

committed in https://core.trac.wordpress.org/changeset/55410 (without the jQuery Migrate related changes)

Note: See TracTickets for help on using tickets.