Skip to content

Commit 91c9def

Browse files
committed
Omit aria-described if no calendar ID.
This occurs on single pages, where the link is not ambiguous.
1 parent 07a3c45 commit 91c9def

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/my-calendar-templates.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,8 +812,9 @@ function mc_create_tags( $event, $context = 'filters' ) {
812812
$google_start = $dtstart;
813813
$google_end = $dtend;
814814
}
815+
$aria_described = ( $calendar_id ) ? " aria-describedby='mc_$event->occur_id-title-$calendar_id'" : '';
815816
$e['gcal'] = mc_google_cal( $google_start, $google_end, $e_link, stripcslashes( $e['title'] ), $map_gcal, $strip_desc );
816-
$e['gcal_link'] = "<a href='" . esc_url( $e['gcal'] ) . "' class='gcal external' rel='nofollow' aria-describedby='mc_$event->occur_id-title-$calendar_id'><span class='mc-icon' aria-hidden='true'></span>" . __( 'Google Calendar', 'my-calendar' ) . '</a>';
817+
$e['gcal_link'] = "<a href='" . esc_url( $e['gcal'] ) . "' class='gcal external' rel='nofollow'" . $aria_described . "><span class='mc-icon' aria-hidden='true'></span>" . __( 'Google Calendar', 'my-calendar' ) . '</a>';
817818

818819
// IDs.
819820
$e['dateid'] = $event->occur_id; // Unique ID for this date of this event.
@@ -843,7 +844,7 @@ function mc_create_tags( $event, $context = 'filters' ) {
843844
mc_get_uri( $event )
844845
);
845846
$e['ical'] = $ical_link;
846-
$e['ical_html'] = "<a class='ical' rel='nofollow' href='" . esc_url( $ical_link ) . "' aria-describedby='mc_$event->occur_id-title-$calendar_id'><span class='mc-icon' aria-hidden='true'></span>" . __( 'iCal', 'my-calendar' ) . '</a>';
847+
$e['ical_html'] = "<a class='ical' rel='nofollow' href='" . esc_url( $ical_link ) . "'" . $aria_described . "><span class='mc-icon' aria-hidden='true'></span>" . __( 'iCal', 'my-calendar' ) . '</a>';
847848

848849
/**
849850
* Filter all template tags after generation.

0 commit comments

Comments
 (0)