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

Open filters on page load #3131

Merged
merged 3 commits into from
Sep 7, 2023
Merged

Open filters on page load #3131

merged 3 commits into from
Sep 7, 2023

Conversation

jon-kirwan
Copy link
Contributor

@jon-kirwan jon-kirwan commented Aug 11, 2023

What

https://trello.com/c/p6FCqlHs/2042-expand-filter-and-location-facets-by-default-on-mobile

Add open_on_load property to open filters, on page load, on mobile. Configured for Find a licence (specialist finder) only.

Why

During user research, a common observation has emerged that mobile users do not interact with the 'Filter' button.

Visual changes

Before (Find a licence)

After (Find a licence)

Anything else

alphagov/publishing-api#2471
alphagov/specialist-publisher#2369

@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 11, 2023 11:45 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 11, 2023 11:52 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 11, 2023 11:57 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 11, 2023 13:33 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 11, 2023 14:17 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 11, 2023 14:30 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 11, 2023 15:56 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 18, 2023 11:37 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 21, 2023 11:12 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 21, 2023 11:28 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 21, 2023 15:17 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 22, 2023 09:11 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 22, 2023 09:26 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 22, 2023 09:49 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 22, 2023 12:03 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 August 22, 2023 13:29 Inactive
Copy link
Contributor

@MartinJJones MartinJJones left a comment

Choose a reason for hiding this comment

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

Changes look good to me overall, just one small comment.

@@ -84,6 +75,22 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
}
}

OptionSelect.prototype.toggleVisibility = function (isDesktop) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably a small nitpick, but I wonder if we should change isDesktop to isMobile and then update the logic within the method.

The reason for this suggestion is that the Design System grid for desktop has a min-width of 769px, so I think we are actually checking for Tablet or Desktop - https://github.com/alphagov/govuk-frontend/blob/87073ebbf6d10f5af1af6c28886cf83c9fd71980/packages/govuk-frontend/src/govuk/settings/_media-queries.scss#L13

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. The only problem is i'd have to reverse the logic which I think it might make it harder to read - not sure if you agree though? e.g.

if (!this.mq.matches) {
  this.toggleVisibility(true)
} else {
  this.toggleVisibility(false)
}

OptionSelect.prototype.toggleVisibility = function (isMobile) {
  if (isMobile) {
    if (this.isClosedOnLoadMobile === 'true' || this.isClosedOnLoad === 'true') {
      this.close()
    } else {
      this.setContainerHeight(201)
    }
  } else {
    if (this.isClosedOnLoad === 'true') {
      this.close()
    } else {
      this.setupHeight()
    }
  }
}

An alternative could be rename the variable to something like isTabletOrLarger?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah good point, I do like isTabletOrLarger, happy to go with that 👍

@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 September 5, 2023 14:21 Inactive
@govuk-ci govuk-ci temporarily deployed to finder-frontend-pr-3131 September 7, 2023 11:30 Inactive
@jon-kirwan jon-kirwan merged commit 4f3354c into main Sep 7, 2023
7 checks passed
@jon-kirwan jon-kirwan deleted the open-filters-on-page-load branch September 7, 2023 11:43
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.

3 participants