Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMS-942: Program- & site-search, contact and fly-out-menu accessibility fixes #169

Merged
merged 4 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

- TMS-942:
- Check / uncheck search filter checkboxes depending on choices
- Trim contact phone number in href
- Increase fly-out-nav z-index to prevent chatbot from overlapping elements
- Add margin for program text-search suggestions

## [1.8.7] - 2023-11-21

### Added
Expand Down
47 changes: 47 additions & 0 deletions assets/scripts/search-filters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2023. Hion Digital
*/

// Use jQuery as $ within this file scope.
const $ = jQuery; // eslint-disable-line no-unused-vars

/**
* Export the class reference.
*/
export default class SearchFilters {

/**
* Check or uncheck checkboxes depending on selections
*
* @param {Object} event Change event
*/
SearchFilters( event ) {
const $checkBoxContainer = $( '.search-filters' );
const $checkBoxes = $checkBoxContainer.find( 'input[type=checkbox]' );
const $clickedCheckbox = event.target;

if ( $( $clickedCheckbox ).is( ':checked' ) ) {
// Uncheck "All"-checkbox when others are checked
if ( $( $clickedCheckbox ).prop( 'id' ) !== 'cpt-all' ) {
$( '#cpt-all' ).prop( 'checked', false );
}
// Uncheck other checkboxes when "All" is selected
else {
$checkBoxes.each( function() {
if ( $( this ).prop( 'id' ) !== 'cpt-all' ) {
$( this ).prop( 'checked', false );
}
} );
}
}
}

/**
* Run when the document is ready.
*
* @return {void}
*/
docReady() {
$( '.search-filters input[type=checkbox]' ).on( 'change', this.SearchFilters.bind( this ) );
}
}
2 changes: 2 additions & 0 deletions assets/scripts/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import GravityFormsPatch from './gravity-forms-patch';
import Countdown from './countdown';
import ProgramSearch from './program-search';
import LoadMore from './load-more';
import SearchFilters from './search-filters';

const globalControllers = {
Common,
Expand Down Expand Up @@ -55,6 +56,7 @@ const globalControllers = {
Countdown,
ProgramSearch,
LoadMore,
SearchFilters,
};

const templateControllers = {
Expand Down
4 changes: 4 additions & 0 deletions assets/styles/blocks/custom/_contacts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
$contacts-gap: .75rem;

.contacts {
&__name {
overflow: hidden !important; // sass-lint:disable no-important
}

&__item {
flex: 1 0 auto;
max-width: calc(100% - $contacts-gap);
Expand Down
3 changes: 2 additions & 1 deletion assets/styles/ui-components/header/_fly-out-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ $fly-out-nav-secondary-link-hover: $primary-invert !default;
$fly-out-nav-search-button-icon: $primary !default;

.fly-out-nav {
z-index: 50;
// z-index unbelievable high to prevent embedded chat overlapping elements
z-index: 9999999999;
display: none;


Expand Down
10 changes: 7 additions & 3 deletions assets/styles/views/_page-program.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@
}

ul.ui-menu {
.ui-menu-item-wrapper {
&.ui-state-active {
background-color: $color-grey;
.ui-menu-item {
margin-bottom: .5rem;

.ui-menu-item-wrapper {
&.ui-state-active {
background-color: $color-grey;
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions lib/Formatters/ContactFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ public function map_keys( array $posts, array $field_keys, $default_image = null
$fields['phone_repeater'] = array_filter( $fields['phone_repeater'], function ( $item ) {
return ! empty( $item['phone_text'] ) || ! empty( $item['phone_number'] );
} );

// Remove whitespaces from phone_number to use on the href
foreach ( $fields['phone_repeater'] as $i => $single_phone ) {
$fields['phone_repeater'][ $i ]['trimmed_number'] = str_replace( ' ', '', $single_phone['phone_number'] );
}
}

return $fields;
Expand Down
2 changes: 1 addition & 1 deletion partials/shared/contact-item.dust
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div>
<span>{phone_text|html}</span>
<div>
<a href="tel:{phone_number|html}"
<a href="tel:{?trimmed_number}{trimmed_number|html}{:else}{phone_number|html}{/trimmed_number}"
class="has-text-paragraph hyphenate">
{phone_number|html}
</a>
Expand Down
Loading