From 4773a48012303dc7ae76ad9a2b3205c99bbcbc13 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Sat, 12 May 2018 17:28:30 +0000 Subject: [PATCH] Privacy: Reposition pointer to ensure dismiss link is always visible. r43158 introduced a new admin pointer for the privacy tools added in 4.9.6. With the previous positioning, though, sometimes the `Dismiss` link would be fixed off screen, making it impossible for the user to dismiss the pointer. This happened when there were enough extra menu items, or when the viewport height was short enough. This commit repositions the pointer to work around that problem. One down side of this workaround is that the arrow will not always be positioned next to the `Tools` menu, where it should be. That's an acceptable compromise given the current time constraints, though. A long term solution would be to make `WP_Pointer` robust enough to handle this use case. Props imath, audrasjb, desrosj. Fixes #44045. git-svn-id: https://develop.svn.wordpress.org/trunk@43246 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-internal-pointers.php | 6 ++++-- src/wp-includes/css/wp-pointer.css | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/class-wp-internal-pointers.php b/src/wp-admin/includes/class-wp-internal-pointers.php index de9c3ef8e2..f3e849d422 100644 --- a/src/wp-admin/includes/class-wp-internal-pointers.php +++ b/src/wp-admin/includes/class-wp-internal-pointers.php @@ -170,18 +170,20 @@ final class WP_Internal_Pointers { if ( is_rtl() ) { $position = array( 'edge' => 'right', - 'align' => 'left', + 'align' => 'bottom', ); } else { $position = array( 'edge' => 'left', - 'align' => 'right', + 'align' => 'bottom', ); } $js_args = array( 'content' => $content, 'position' => $position, + 'pointerClass' => 'wp-pointer arrow-bottom', + 'pointerWidth' => 420, ); self::print_js( 'wp496_privacy', '#menu-tools', $js_args ); } diff --git a/src/wp-includes/css/wp-pointer.css b/src/wp-includes/css/wp-pointer.css index f1856d995c..f8d58be9f6 100644 --- a/src/wp-includes/css/wp-pointer.css +++ b/src/wp-includes/css/wp-pointer.css @@ -207,6 +207,15 @@ content: " "; } +.wp-pointer.arrow-bottom .wp-pointer-content { + margin-bottom: -45px; +} + +.wp-pointer.arrow-bottom .wp-pointer-arrow { + top: 100%; + margin-top: -30px; +} + /* Disable pointers at responsive sizes */ @media screen and ( max-width: 782px ) { .wp-pointer {