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

lib-classifier: Refactor survey task filtering #6619

Open
wants to merge 39 commits into
base: lib-classifier_survey-layout-fixes
Choose a base branch
from

Conversation

mcbouslog
Copy link
Contributor

@mcbouslog mcbouslog commented Jan 14, 2025

Package

  • lib-classifier

Linked Issue and/or Talk Post

Describe your changes

  • refactor filter styling per Figma
  • refactor FilterLabel styling
  • refactor CharacteristicSection to proper radio input group
  • refactor Characteristics to show with Choices
  • refactor FilterStatus button styling
  • refactor "Showing x of y" and "Clear all filters" styling

How to Review

Helpful explanations that will make your reviewer happy:

Checklist

PR Creator - Please cater the checklist to fit the review needed for your code changes.
PR Reviewer - Use the checklist during your review. Each point should be checkmarked or discussed before PR approval.

General

  • Tests are passing locally and on Github
  • Documentation is up to date and changelog has been updated if appropriate
  • You can yarn panic && yarn bootstrap or docker-compose up --build and FEM works as expected
  • FEM works in all major desktop browsers: Firefox, Chrome, Edge, Safari (Use Browserstack account as needed)
  • FEM works in a mobile browser

General UX

Example Staging Project: i-fancy-cats

  • All pages of a FEM project load: Home Page, Classify Page, and About Pages
  • Can submit a classification
  • Can sign-in and sign-out
  • The component is accessible

Bug Fix

  • The PR creator has listed user actions to use when testing if bug is fixed
  • The bug is fixed
  • Unit tests are added or updated

Refactoring

  • The PR creator has described the reason for refactoring
  • The refactored component(s) continue to work as expected

Post-merge

  • This PR adds translations keys to English dictionary(s). See guidance for pulling new keys to Lokalise here.

mcbouslog and others added 30 commits November 25, 2024 15:36
@mcbouslog mcbouslog marked this pull request as ready for review January 16, 2025 18:01
@mcbouslog mcbouslog changed the title [DRAFT] lib-classifier: Refactor survey task filtering lib-classifier: Refactor survey task filtering Jan 16, 2025
@mcbouslog mcbouslog linked an issue Jan 16, 2025 that may be closed by this pull request
direction='row'
>
<SpacedText size='1rem'>
{t('SurveyTask.CharacteristicsFilter.closeFilters')}
Copy link
Contributor Author

@mcbouslog mcbouslog Jan 16, 2025

Choose a reason for hiding this comment

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

Should this have a hover style? It currently has a focus style - box-shadow: 0 0 2px 2px #addde0; - could add the same for hover.

cc: @seanmiller26

Comment on lines +111 to +129
<Button
key={`${characteristicId}-${selectedValueId}`}
a11yTitle={t('SurveyTask.CharacteristicsFilter.removeFilter', { valueLabel: label })}
label={
<FilterLabel
characteristicId={characteristicId}
selected={true}
valueId={selectedValueId}
valueImageSrc={valueImageSrc}
valueLabel={label}
/>
}
margin={{
bottom: 'xxsmall',
left: 'xxsmall'
}}
onClick={clearSelection}
plain
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should the buttons to remove a filter have a hover style?

Currently there might be a very subtle change in the color of the close button that sits on top of the filter image, but maybe with the new button with the "x" to the right of the image a border or box-shadow on the button might be helpful on hover.

cc: @seanmiller26

function handleFilterDropOpen () {
setFilterDropOpen(true)
}
const [filterOpen, setFilterOpen] = useState(false)
Copy link
Contributor Author

@mcbouslog mcbouslog Jan 16, 2025

Choose a reason for hiding this comment

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

I think adding Grommet's AnnounceContext to announce how many choices ("Showing x of y choices") after applying a filter is straightforward:

const announce = useContext(AnnounceContext)

useEffect(function announceFilteredChoiceCount () {
  announce(`Showing ${filteredChoiceIds.length} of ${task.choices.size} choices`, 'polite', 1000)
}, [filteredChoiceIds?.length, task.choices.size, announce])

Not sure if it would be helpful or unhelpful noise? Once a user tabs to the menu item list similar information ("item x of y") is announced, so this might not be change to be made.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have a definitive opinion on this, but considering it's few lines of code and you thought it worth investigating, happy to leave it in for now unless a volunteer reports difficulty using accessibility tools and the survey task.

@goplayoutside3
Copy link
Contributor

The filters are functioning as expected and the Storybook looks good~

However, while testing app-project run locally, I noticed that an expandable filters section introduces an annoying page jump, and it's worth flagging to @seanmiller26. Below is a video showing what happens when I expand the task area, and then collapse the task area. Because that component of the page is increasing and decreasing in height, the page appears to scroll down below the classifier on collapse. I anticipate volunteers will immediately flag this as annoying in comparison to filters that popover. Is there anything we can do mitigate the jumping effect on filters collapse?

jumping.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants