Make WordPress Core

Opened 18 months ago

Closed 16 months ago

Last modified 12 months ago

#38849 closed defect (bug) (fixed)

Shortcode wpview's toolbar appears while no view is selected

Reported by: bduclos Owned by: azaozz
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.6.1
Component: TinyMCE Keywords: has-screenshots has-patch
Focuses: javascript Cc:


When you copy paste a shortcode wpview, the toolbar with the edit/delete buttons appears above the pasted view while the view is not selected (clicking on the buttons does nothing).

It also happens when you refresh a page and the first element of the editor is a shortcode view.

Bugs on all browsers in Trunk and WP4.6

Attachments (1)

38849.patch (1.2 KB) - added by gitlost 18 months ago.
Check view selected on setting toolbar and always resposition and show.

Download all attachments as: .zip

Change History (14)

#1 @swissspidy
18 months ago

  • Keywords needs-screenshots added

#2 @danielbachhuber
18 months ago

I'm pretty sure I've seen this too, although I wasn't able to track down the cause when I looked into it.

#3 @bduclos
18 months ago

  • Keywords has-screenshots added; needs-screenshots removed

Steps to reproduce: Click on the Add Media button to create and insert a gallery. Copy the gallery view (Ctrl+C) and paste it after (Ctrl+V).

Result: The toolbar with the edit/delete buttons appears above the pasted view while the view is not selected. Clicking on the edit or delete buttons does nothing. However if you click on the view to select it, the buttons work normally.


#4 @swissspidy
18 months ago

  • Focuses javascript added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release
  • Version changed from trunk to 4.6.1

18 months ago

Check view selected on setting toolbar and always resposition and show.

#5 @gitlost
18 months ago

  • Keywords has-patch added; needs-patch removed

The patch checks that the view is selected before setting the toolbar on the wptoolbar event in "tinymce/plugins/wpview/plugin.js".

There's also a change to the nodechange action in "tinymce/plugins/wordpress/plugin.js" just after it fires the wptoolbar event, to make sure the toolbar is repositioned and shown always, in case a selected view is scrolled out of view and then a different (visible!) view selected, which could have resulted in the toolbar not displaying on the newly selected view.

#6 @azaozz
16 months ago

#37753 was marked as a duplicate.

#7 @azaozz
16 months ago

I'm able to reproduce this every time now. It's triggered by firing multiple nodechange events in the editor. This event is used to set or refresh the inline toolbar and seems to error out when it is fired more than once for the same element, especially after the initial loading of HTML in the editor.

Looking at 38849.patch, don't think we need to change the floating toolbar code. It is enough to check whether the selection is collapsed when a wpview node is selected.

#8 @azaozz
16 months ago

  • Milestone changed from Future Release to 4.8

#9 @azaozz
16 months ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 39904:

TinyMCE: prevent the inline toolbar from appearing on partially selected wpview nodes. This can happen when HTML is initially loaded in the editor and wpview is the first node, or sometimes on repeatedly pasting the same wpview.

Props gitlost.
Fixes #38849.

#10 follow-up: @gitlost
16 months ago

I suppose you could consider it a different bug but I just checked again and can reproduce the second scroll issue on Firefox/Chrome on Ubuntu, Safari/Firefox/Chrome on macOS, and Edge/Firefox/Chrome on Windows 10.

#11 in reply to: ↑ 10 @azaozz
16 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to gitlost: Yeah, different bug. I thought there was already a ticket for it, but seems not. May as well fix it here.

#12 @azaozz
16 months ago

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

In 39910:

TinyMCE: ensure the inline toolbar is shown and properly positioned when there are several wpview blocks in the editor and the user selects one after the other.

Props gitlost.
Fixes #38849.

#13 @ocean90
12 months ago

#40618 was marked as a duplicate.

Note: See TracTickets for help on using tickets.