Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Gifting banner: Keep the "?" and Gift buttons readable under theme button styles, stop long Gift labels being clipped on mobile, and give the "?" button an accessible name.
Original file line number Diff line number Diff line change
Expand Up @@ -66,42 +66,48 @@
text-align: left;
}

.wpcom-gifting-banner__button {
/* Scoped to the ID so theme and page-builder button rules
* (e.g. `.elementor-kit-N button`) can't restyle the banner. */
#wpcom-gifting-banner .wpcom-gifting-banner__button,
#wpcom-gifting-banner .wpcom-gifting-banner__more-info-button {
all: unset;
cursor: pointer;
}

#wpcom-gifting-banner .wpcom-gifting-banner__button {
flex-shrink: 0;
white-space: nowrap;
background: #fff;
color: #000;
border: none;
border-radius: 2px;
font-weight: 600;
font-size: 16px;
line-height: 20px;
height: 32px;
margin-left: 12px;
padding: 6px 24px 6px 24px;
margin-inline-start: 12px;
padding: 6px 24px;
}

.wpcom-gifting-banner .wpcom-gifting-banner__button:hover {
background: #fff;
color: #000;
}

.wpcom-gifting-banner__more-info-button,
.wpcom-gifting-banner__more-info-button:hover {
cursor: pointer;
position: relative;
background: none;
border: 0;
padding: 6px 12px;
#wpcom-gifting-banner .wpcom-gifting-banner__more-info-button {
display: inline-flex;
align-items: center;
justify-content: center;
width: 24px;
height: 22px;
margin-inline-start: 4px;
vertical-align: top;
}

.wpcom-gifting-banner__more-info-button::before {
background: url(../images/gridicons-help-outline.svg) no-repeat center;
#wpcom-gifting-banner .wpcom-gifting-banner__more-info-button::before {
content: "";
height: 16px;
width: 16px;
position: absolute;
bottom: 4px;
left: 5px;
height: 16px;
background: url(../images/gridicons-help-outline.svg) no-repeat center / 16px 16px;
}

#wpcom-gifting-banner .wpcom-gifting-banner__button:focus-visible,
#wpcom-gifting-banner .wpcom-gifting-banner__more-info-button:focus-visible {
outline: 2px solid #fff;
outline-offset: 2px;
}

@media (max-width: 480px) {
Expand All @@ -116,9 +122,13 @@
height: 26px;
}

/* Hidden so it can't wrap onto its own line; the gap replaces its margins. */
.wpcom-gifting-banner__img {
height: 16px;
width: 16px;
display: none;
}

.wpcom-gifting-banner__wrapper {
column-gap: 4px;
}

.wpcom-gifting-banner__title,
Expand All @@ -131,7 +141,12 @@
font-weight: 600;
}

.wpcom-gifting-banner__button {
#wpcom-gifting-banner .wpcom-gifting-banner__button {
font-size: 12px;
padding: 6px 16px;
}

#wpcom-gifting-banner .wpcom-gifting-banner__more-info-button {
height: 15px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,11 @@ public function inject_gifting_banner_wpcom() {
'title' => $this->get_title_texts( $days_to_expire ),
'subtitle' => $this->get_subtitle_texts( $this->current_plan, $days_to_expire ),
'button_text' => _x( 'Gift', 'verb', 'wpcomsh' ),
'more_info' => __( 'Learn more', 'wpcomsh' ),
);
// Change the version if associated files are updated, current: 20230103.
wp_enqueue_style( 'gifting-banner', plugins_url( 'gifting-banner/css/gifting-banner.css', __FILE__ ), array(), '20230103' );
wp_enqueue_script( 'gifting-banner', plugins_url( 'gifting-banner/js/gifting-banner.js', __FILE__ ), array(), '20230103', true );
// Change the version if associated files are updated, current: 20261109.
wp_enqueue_style( 'gifting-banner', plugins_url( 'gifting-banner/css/gifting-banner.css', __FILE__ ), array(), '20261109' );
wp_enqueue_script( 'gifting-banner', plugins_url( 'gifting-banner/js/gifting-banner.js', __FILE__ ), array(), '20261109', true );
wp_localize_script( 'gifting-banner', 'gifting_banner', $data );
wp_set_script_translations( 'gifting-banner', 'wpcomsh' );
}
Expand All @@ -165,6 +166,7 @@ public function inject_gifting_banner_wpcomsh() {
'verb',
'wpcomsh'
),
'more_info' => __( 'Learn more', 'wpcomsh' ),
);

wp_enqueue_style( 'gifting-banner', plugins_url( 'css/gifting-banner.css', __FILE__ ), array(), WPCOMSH_VERSION );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
const more_info_button = document.createElement( 'BUTTON' );
more_info_button.setAttribute( 'id', 'wpcom-gifting-banner-more-info-button' );
more_info_button.setAttribute( 'class', 'wpcom-gifting-banner__more-info-button' );
if ( gifting_banner.i18n.more_info ) {
more_info_button.setAttribute( 'aria-label', gifting_banner.i18n.more_info );
}
const button_text = document.createTextNode( gifting_banner.i18n.button_text );

notice.getElementsByClassName( 'wpcom-gifting-banner__title' )[ 0 ].appendChild( title );
Expand Down
Loading