bu-ist / responsive-framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not hide event titles on calendar pages when using BU Banners, even if a custom title is added to the calendar template page

ashleykolodziej opened this issue · comments

Responsive Version:

2x with BU Banners installed

Expected behavior:

On single event calendar pages, both the banner AND the event title should always show, even if you add a custom title to the banner.

Actual behavior:

On single event calendar pages, the banner shows, but the event title is hidden using the visually hidden class.

Link generated by whatsmybrowser.org:

Affects all browsers.

Link(s) where this can be reproduced:

Steps to reproduce:

  1. Activate BU Banners on a site.
  2. Ensure BU Calendar is enabled.
  3. Add a banner, including a custom title, to the calendar template page (main calendar page).
  4. Visit a single event. It will use the main calendar's banner title, and hide the event title.

Screenshot (if this is a bug):

Screen Shot 2021-07-19 at 12 03 28 PM

Related ServiceNow Ticket number (if available):

INC13261584

Related code:

I believe the code that controls this is over here:

// Else, add classes if we have a bu banner, its content is not empty, and there is a title field supplied.
} elseif ( bu_has_banner( $object_id ) && ! empty( $banner_content[0] ) && ! empty( $banner_content[0]['title'] ) ) {
/**
* Filters Responsive Framework page title classes, to make the generic H1 visually hidden,
* but still accessible to screen readers.
*
* @since 2.1.5
*
* @param string $class Class to be applied to the H1.
* @return string $class
*/
add_filter(
'responsive_the_title_class',
function( $class ) {
if ( ! empty( $class ) && strpos( $class, 'u-visually-hidden' ) === false ) {
$class .= ' u-visually-hidden';
} elseif ( empty( $class ) ) {
$class = 'u-visually-hidden';
}
return $class;
}
);
}

@ashleykolodziej
There's a list of conditions that need to be true for the class to be applied. I feel the safest way is to add to that check, not to be a calendar event. so: if bla and bla and bla AND not a calendar single give me the hidden class. That way we know it won't effect anything else

Here's a pull request!!!
#273

@aremery if this is closed, please update the tags to remove on dev list and needs resourcing so that we know it is all set.