Make WordPress Core

Changeset 63549


Ignore:
Timestamp:
09/09/2026 01:53:06 AM (8 hours ago)
Author:
joedolson
Message:

Administration: Prevent race condition in wp-tooltip.js delay timer.

Move the timer variable openTimeout from the outer scope of the wrapper function to the inner scope, preventing reuse of the same timer instance by different tooltips.

Props fahimmurshed, westonruter, joedolson.
Fixes #65674.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/wp/wp-tooltip.js

    r63543 r63549  
    1717        const popovers = /** @type {NodeListOf<HTMLSpanElement>} */ ( document.querySelectorAll( '.wp-is-tooltip' ) );
    1818
    19         /** @type {ReturnType<typeof setTimeout>} */
    20         let openTimeout;
    21 
    2219        popovers.forEach( function( popover ) {
    2320                const trigger = /** @type {HTMLButtonElement|HTMLAnchorElement|null} */ ( popover.querySelector( '.wp-tooltip__toggle' ) );
     
    3128                        return;
    3229                }
     30
     31                /** @type {ReturnType<typeof setTimeout>} */
     32                let openTimeout;
    3333
    3434                // Show Tooltip Function (with delay to prevent flickering).
Note: See TracChangeset for help on using the changeset viewer.