Skip to content

Commit f2bd8a2

Browse files
authored
Merge pull request #169 from devgeniem/TMS-942
TMS-942: Program- & site-search, contact and fly-out-menu accessibility fixes
2 parents fdb34a3 + 4d2b201 commit f2bd8a2

File tree

8 files changed

+73
-5
lines changed

8 files changed

+73
-5
lines changed

CHANGELOG.MD

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616
- TMS-940:
1717
- Change mobile menu dropdown links to a single button-element
1818
- Hide current language on mobile header if only 2 languages in use
19+
- TMS-942:
20+
- Check / uncheck search filter checkboxes depending on choices
21+
- Trim contact phone number in href
22+
- Increase fly-out-nav z-index to prevent chatbot from overlapping elements
23+
- Add margin for program text-search suggestions
1924
- TMS-995: Show project-listing component images in projects-page
2025

2126
## [1.8.7] - 2023-11-21

assets/scripts/search-filters.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2023. Hion Digital
3+
*/
4+
5+
// Use jQuery as $ within this file scope.
6+
const $ = jQuery; // eslint-disable-line no-unused-vars
7+
8+
/**
9+
* Export the class reference.
10+
*/
11+
export default class SearchFilters {
12+
13+
/**
14+
* Check or uncheck checkboxes depending on selections
15+
*
16+
* @param {Object} event Change event
17+
*/
18+
SearchFilters( event ) {
19+
const $checkBoxContainer = $( '.search-filters' );
20+
const $checkBoxes = $checkBoxContainer.find( 'input[type=checkbox]' );
21+
const $clickedCheckbox = event.target;
22+
23+
if ( $( $clickedCheckbox ).is( ':checked' ) ) {
24+
// Uncheck "All"-checkbox when others are checked
25+
if ( $( $clickedCheckbox ).prop( 'id' ) !== 'cpt-all' ) {
26+
$( '#cpt-all' ).prop( 'checked', false );
27+
}
28+
// Uncheck other checkboxes when "All" is selected
29+
else {
30+
$checkBoxes.each( function() {
31+
if ( $( this ).prop( 'id' ) !== 'cpt-all' ) {
32+
$( this ).prop( 'checked', false );
33+
}
34+
} );
35+
}
36+
}
37+
}
38+
39+
/**
40+
* Run when the document is ready.
41+
*
42+
* @return {void}
43+
*/
44+
docReady() {
45+
$( '.search-filters input[type=checkbox]' ).on( 'change', this.SearchFilters.bind( this ) );
46+
}
47+
}

assets/scripts/theme.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import GravityFormsPatch from './gravity-forms-patch';
2828
import Countdown from './countdown';
2929
import ProgramSearch from './program-search';
3030
import LoadMore from './load-more';
31+
import SearchFilters from './search-filters';
3132
import FocusOnSearch from './focus-on-search';
3233

3334
const globalControllers = {
@@ -56,6 +57,7 @@ const globalControllers = {
5657
Countdown,
5758
ProgramSearch,
5859
LoadMore,
60+
SearchFilters,
5961
FocusOnSearch,
6062
};
6163

assets/styles/blocks/custom/_contacts.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
$contacts-gap: .75rem;
66

77
.contacts {
8+
&__name {
9+
overflow: hidden !important; // sass-lint:disable no-important
10+
}
11+
812
&__item {
913
flex: 1 0 auto;
1014
max-width: calc(100% - $contacts-gap);

assets/styles/ui-components/header/_fly-out-nav.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ $fly-out-nav-secondary-link-hover: $primary-invert !default;
1313
$fly-out-nav-search-button-icon: $primary !default;
1414

1515
.fly-out-nav {
16-
z-index: 50;
16+
// z-index unbelievable high to prevent embedded chat overlapping elements
17+
z-index: 9999999999;
1718
display: none;
1819

1920

assets/styles/views/_page-program.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,13 @@
6161
}
6262

6363
ul.ui-menu {
64-
.ui-menu-item-wrapper {
65-
&.ui-state-active {
66-
background-color: $color-grey;
64+
.ui-menu-item {
65+
margin-bottom: .5rem;
66+
67+
.ui-menu-item-wrapper {
68+
&.ui-state-active {
69+
background-color: $color-grey;
70+
}
6771
}
6872
}
6973
}

lib/Formatters/ContactFormatter.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,11 @@ public function map_keys( array $posts, array $field_keys, $default_image = null
139139
$fields['phone_repeater'] = array_filter( $fields['phone_repeater'], function ( $item ) {
140140
return ! empty( $item['phone_text'] ) || ! empty( $item['phone_number'] );
141141
} );
142+
143+
// Remove whitespaces from phone_number to use on the href
144+
foreach ( $fields['phone_repeater'] as $i => $single_phone ) {
145+
$fields['phone_repeater'][ $i ]['trimmed_number'] = str_replace( ' ', '', $single_phone['phone_number'] );
146+
}
142147
}
143148

144149
return $fields;

partials/shared/contact-item.dust

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<div>
3030
<span>{phone_text|html}</span>
3131
<div>
32-
<a href="tel:{phone_number|html}"
32+
<a href="tel:{?trimmed_number}{trimmed_number|html}{:else}{phone_number|html}{/trimmed_number}"
3333
class="has-text-paragraph hyphenate">
3434
{phone_number|html}
3535
</a>

0 commit comments

Comments
 (0)