Make WordPress Core


Ignore:
Timestamp:
07/14/2026 06:50:18 PM (3 months ago)
Author:
joedolson
Message:

Administration: Add function for tooltips and toggle tips.

Add functions wp_get_tooltip() and wp_get_toggletip() to support adding these popover interfaces in the core admin. wp_get_tooltip() is used as mechanism to expose accessible names when a control has focus or hover, and wp_get_toggletip() implements a popover disclosure dialog to provide extended help information.

Functions generate accessible markup, written to avoid excess verbosity for screen readers and apply best practices for voice command users as much as possible for icon-only controls.

Add an initial implementation of a toggle tip to explain the 'remember me' option on the login screen.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/12212

Props joedolson, oglekler, afercia, davidbaumwald, rajinsharwar, mukesh27, swissspidy, sirlouen, rutviksavsani, wildworks, ayazahmed12, generosus, sergeybiryukov.
Fixes #51006, #55343.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-login.php

    r62735 r62741  
    15091509
    15101510                wp_enqueue_script( 'user-profile' );
     1511                wp_enqueue_script( 'wp-tooltip' );
    15111512                ?>
    15121513
    … …  
    15361537
    15371538                        ?>
    1538                         <p class="forgetmenot"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <label for="rememberme"><?php esc_html_e( 'Remember Me' ); ?></label></p>
     1539                        <?php
     1540                        /**
     1541                         * Filters the help text shown in the "Remember Me" tooltip on the login form.
     1542                         *
     1543                         * Returning an empty string removes the tooltip toggle from the form.
     1544                         *
     1545                         * @since 7.1.0
     1546                         *
     1547                         * @param string $rememberme_help_text The tooltip help text.
     1548                         */
     1549                        $rememberme_help_text = apply_filters(
     1550                                'login_remember_me_help_text',
     1551                                __( 'Selecting "Remember Me" reduces the number of times you&#8217;ll be asked to log in using this device. To keep your account secure, use this option only on your personal devices.' )
     1552                        );
     1553                        ?>
     1554                        <p class="forgetmenot">
     1555                                <input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> />
     1556                                <label for="rememberme"><?php esc_html_e( 'Remember Me' ); ?></label>
     1557                                <?php
     1558                                echo wp_get_toggletip(
     1559                                        $rememberme_help_text,
     1560                                        array(
     1561                                                'id'    => 'rememberme-help-toggletip',
     1562                                                'label' => __( 'Help' ),
     1563                                        )
     1564                                );
     1565                                ?>
     1566                        </p>
    15391567                        <p class="submit">
    15401568                                <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); ?>" />
Note: See TracChangeset for help on using the changeset viewer.