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

Add Date Filter #3700

Merged
merged 6 commits into from
Oct 23, 2023
Merged

Add Date Filter #3700

merged 6 commits into from
Oct 23, 2023

Conversation

burhandodhy
Copy link
Contributor

@burhandodhy burhandodhy commented Oct 17, 2023

Description of the Change

This PR adds a new Filter block that is the "Date Filter"

Closes #3634

How to test the Change

Changelog Entry

Added - New Date Filter Block

Credits

Props @burhandodhy

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@burhandodhy burhandodhy changed the title Add Date block Add Date Filter Oct 17, 2023
@felipeelia felipeelia linked an issue Oct 17, 2023 that may be closed by this pull request
1 task
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@burhandodhy I gave it a quick look and overall it looks good, just added a few comments. Let's also ask @JakePT to give it a look.

includes/classes/Feature/Facets/Facets.php Outdated Show resolved Hide resolved
assets/css/facets.css Outdated Show resolved Hide resolved
assets/js/blocks/facets/date/Edit.js Outdated Show resolved Hide resolved
assets/js/blocks/facets/date/index.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
assets/js/facets.js Outdated Show resolved Hide resolved
includes/classes/Feature/Facets/Facets.php Outdated Show resolved Hide resolved
assets/js/blocks/facets/date/Edit.js Outdated Show resolved Hide resolved
includes/classes/Feature/Facets/Types/Date/Renderer.php Outdated Show resolved Hide resolved

<?php if ( $this->display_custom_date ) : ?>
<li>
<a aria-label="Apply filter: <?php esc_html_e( 'Custom', 'elasticpress' ); ?>" href="#" rel="nofollow" class="ep-date-range-custom <?php echo $is_custom_date ? 'checked' : ''; ?>">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will need some changes for accessibility, only when the filter is not applied:

  • Add role="button"
  • Add an aria-expanded attribute that changes when the date form is shown.
  • Change the aria-label to something like "Select date range".

When it is already applied it should just be a link and the label should read "Remove filter", like the checkbox filters.

includes/classes/Feature/Facets/Types/Date/FacetType.php Outdated Show resolved Hide resolved
@burhandodhy burhandodhy marked this pull request as ready for review October 20, 2023 12:47
@felipeelia felipeelia added this to the 5.0.0 milestone Oct 22, 2023
Copy link
Member

@felipeelia felipeelia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@burhandodhy I gave this a try and if I uncheck the "Display custom date option" and save, the block doesn't seem to work anymore. (I see a Cannot read properties of null (reading 'classList') error in the console.)

@felipeelia felipeelia merged commit 4a894d0 into 5.0.0 Oct 23, 2023
11 of 13 checks passed
@felipeelia felipeelia deleted the feature/3634 branch October 23, 2023 16:46
@felipeelia felipeelia mentioned this pull request Oct 23, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filter by Date
3 participants