[wp-trac] [WordPress Trac] #57995: Popup flickering in Firefox

WordPress Trac noreply at wordpress.org
Fri May 19 09:09:46 UTC 2023


#57995: Popup flickering in Firefox
-------------------------------------+-------------------------------------
 Reporter:  robehr79                 |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  6.2.2
Component:  TinyMCE                  |     Version:  6.0
 Severity:  major                    |  Resolution:
 Keywords:  needs-patch dev-         |     Focuses:  javascript,
  feedback                           |  administration
-------------------------------------+-------------------------------------

Comment (by robehr79):

 Sorry for coming up this unprofessional wayb y simply putting the patch
 verbatim here, but I think that this is the fix to the flickering, as
 Patch file:

 {{{
 --- a/wp-includes/js/tinymce/plugins/wordpress/plugin.js
 +++ b/wp-includes/js/tinymce/plugins/wordpress/plugin.js
 @@ -790,12 +790,14 @@ tinymce.PluginManager.add( 'wordpress', function(
 editor ) {
                         currentSelection,
                         timeout,
                         container = editor.getContainer(),
 +                       editorContainer = document.querySelector
 (".interface-navigable-region.interface-interface-skeleton__content"),
                         wpAdminbar = document.getElementById( 'wpadminbar'
 ),
                         mceIframe = document.getElementById( editor.id +
 '_ifr' ),
                         mceToolbar,
                         mceStatusbar,
                         wpStatusbar,
 -                       cachedWinSize;
 +                       cachedWinSize,
 +                       cachedScrollPos;

                         if ( container ) {
                                 mceToolbar = tinymce.$( '.mce-toolbar-
 grp', container )[0];
 @@ -1154,6 +1156,19 @@ tinymce.PluginManager.add( 'wordpress', function(
 editor ) {
                                                 }
                                         }

 +                                       if ( event.type === "scroll" ||
 event.type === "scrollwindow" ) {
 +
 +                                               if ( cachedScrollPos ) {
 +                                                       if (
 editorContainer.scrollLeft === cachedScrollPos.X &&
 editorContainer.scrollTop === cachedScrollPos.Y ) return;
 +                                               } else {
 +                                                       cachedScrollPos =
 {
 +                                                               X:
 editorContainer.scrollLeft,
 +                                                               Y:
 editorContainer.scrollTop,
 +                                                       };
 +                                                       return;
 +                                               }
 +                                       }
 +
                                         clearTimeout( timeout );

                                         timeout = setTimeout( function() {
 @@ -1165,6 +1180,7 @@ tinymce.PluginManager.add( 'wordpress', function(
 editor ) {

                                         activeToolbar.scrolling = true;
                                         activeToolbar.hide();
 +                                       cachedScrollPos = null;
                                 }
                         }
                 }
 --

 }}}

 Feel free to improve it accordingly. Sadly enough, this fixes the
 flickering but there is another issue: The toolbar does not close reliably
 when it loses the focus, neither in Firefox nor in Chrome, neither with
 nor without this fix.

 Sorry, I won't have time to investigate deeper. I hope my contribution
 helps.

 Kind regards,
 Robert

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57995#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list