Make WordPress Core

Opened 3 weeks ago

Last modified 11 days ago

#65674 new defect (bug)

Tooltip Delay Timer Race Condition (wp-includes/js/wp-tooltip.js)

Reported by: fahimmurshed Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version: 7.0.2
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: javascript

Description

The timer variable (openTimeout) used to delay tooltip opening was declared in the outer scope of the script's wrapper function. Because it was shared globally across all tooltips, event listeners on separate tooltips interacted with the exact same timer instance. When a user moved their mouse cursor or used keyboard Tab navigation to switch tooltips, the blur/mouseleave event on the previous tooltip would clear the shared timer. This cleared any pending timeout for the next tooltip, preventing it from opening entirely.

Impact: Severe keyboard accessibility breakdown (preventing consecutive tooltip views during Tab traversal) and erratic mouse-hover behavior.

Attachments (2)

wp-tooltip.diff (885 bytes ) - added by fahimmurshed 3 weeks ago.
wp-tooltip.min.diff (1.3 KB ) - added by fahimmurshed 3 weeks ago.

Download all attachments as: .zip

Change History (3)

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


11 days ago
#1

  • Keywords has-unit-tests added

Initialize undefined variables in several functions to prevent PHP 8.2+ warnings (in single_month_title, get_the_generator, WP_HTML_Processor, wp_mime_type_icon, and _wp_privacy_send_request_confirmation_notification).

Fix a bug in do_enclose() where the enclosure meta was storing the variable name 'mime' instead of the actual MIME type variable '$type'.

Add aria-hidden attribute to dashicons span for improved accessibility, and add test coverage for the do_enclose fix with no-extension content types.

### Description

This PR addresses multiple PHP 8.2+ compatibility issues, undefined variable warnings, a bug in enclosure postmeta creation, accessibility improvements, and unit test coverage:

  1. PHP 8.2+ Compatibility & Undefined Variable Fixes:
    • single_month_title(): Initialized $my_year and $my_month to prevent E_WARNING notices when $monthnum is supplied without $year.
    • get_the_generator(): Initialized $gen to an empty string before switch ( $type ) to handle custom generator types passed via filters without throwing undefined variable warnings.
    • WP_HTML_Processor::in_body_any_other_end_tag(): Initialized $node = null prior to traversing open element stack to avoid undefined variable access when stack is empty.
    • wp_mime_type_icon(): Initialized $icon = false before mime type matching loop to guarantee definition when passed to wp_mime_type_icon filter.
    • _wp_privacy_send_request_confirmation_notification(): Initialized $manage_url to avoid undefined variable warnings when custom privacy request actions are used.
  1. Fix do_enclose() Bug:
    • Updated do_enclose() in wp-includes/functions.php to use $type instead of undefined $mime when setting the enclosure postmeta value. This resolves an E_WARNING notice under PHP 8+ and ensures the HTTP Content-Type header (e.g. video/mp4) is correctly persisted for URLs without extension mapping.
  1. Accessibility Improvements:
    • Added aria-hidden="true" to decorative <span class="dashicons dashicons-warning"></span> element in recovery mode notices within class-wp-plugins-list-table.php to improve screen reader accessibility.
  1. Test Coverage:
    • Added test dataset header-type-no-extension and HTTP response mocking in tests/phpunit/tests/functions/doEnclose.php to verify do_enclose() processes extensionless media URLs without PHP 8 warnings.

Trac ticket: https://core.trac.wordpress.org/ticket/65674

## Use of AI Tools

AI assistance: Yes
Tool(s): Antigravity AI
Model(s): Gemini 3.6 Flash
Used for: Identifying PHP 8.2+ undefined variable warnings and do_enclose() bug, generating unit test dataset, and assisting with code formatting. All code changes and tests were verified against static analysis tools and unit tests.

Note: See TracTickets for help on using tickets.