Skip to content

Remote browsing filters#10986

Merged
marcellamaki merged 9 commits intolearningequality:developfrom
rtibbles:remote_browsing_filters
Jul 19, 2023
Merged

Remote browsing filters#10986
marcellamaki merged 9 commits intolearningequality:developfrom
rtibbles:remote_browsing_filters

Conversation

@rtibbles
Copy link
Member

@rtibbles rtibbles commented Jul 17, 2023

Summary

  • Updates logic for displaying whether categories are enabled or disabled within a channel, after incomplete refactor
  • Makes SearchFiltersPanel responsible solely for displaying search filters
  • Makes SearchFiltersPanel handle its own modal display when needed
  • Removes duplicated section tag
  • Updates SidePanelModal to remove Search filters panel specific aria label, and insert via a prop instead
  • Create TopicsPanelModal for displaying topics in the TopicsPage
  • Moves all 'currentCategory' logic inside SearchFiltersPanel to encapsulate and reuse logic
  • Uses vue2-teleport to allow KModal use from within a fixed position div, which seems to have been the reason it was previously embedded outside of the SidePanelModal component.
  • Update how we display selected categories in the category selection modal to match the original spec
  • Update how category selection works, so that all actual categories (but not 'Uncategorized') are additive in their selection, meaning:
    • Selecting a category when another category is already selected will now filter by both categories
    • Selecting a category when that category is already selected will now remove filtering by that category
    • Selecting a category when any of its descendant categories are selected will deselect the descendant categories, and only select the ancestor category that the user clicked
  • Fix bug in metadata label filtering, whereby it was doing an OR when multiple categories, learning activities, etc. were selected rather than an AND
  • Adds a regression test for this bug

References

Fixes #10975
Fixes #10976
Implements this design:
Screenshot 2023-07-14 at 2 01 35 PM
Screenshot 2023-07-14 at 2 01 15 PM

Reviewer guidance

Removing the aria-label now means that the SidePanelModal doesn't have an aria-label in other places where it is used, but as the previous label was incorrect, this doesn't seem like a regression. We should open a follow up issue for this.

I am very sure that none of the code moves I did moved any strings around, but a double check would never hurt.

I may not have implemented the above design precisely to spec, as the highlight is the same width as the text, not the overall block - so that may need an update? Could also be filed as a follow up issue.

For manual testing, this needs to be tested for searching and filtering on the Library page (both local and remote for peers) and within channels (both for local and remote peers).

I am very sure that the bug that is the root cause of the OR behaviour noted in #10975 is present in Studio, even if it is not manifesting (probably because of differences in Library content).


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... APP: Learn Re: Learn App (content, quizzes, lessons, etc.) SIZE: large labels Jul 17, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 17, 2023

@pcenov
Copy link
Member

pcenov commented Jul 18, 2023

Hi @rtibbles,

  1. The issue described in Kolibri Library - It's possible to filter by more than one activity type #10975 is still present - does that mean that it has to be reported and fixed on Studio's side? Perhaps it's worth discussing and specifying the expected behavior for the Categories and Activities filters as it's different from the rest (we are adding up results and not excluding). That becomes especially obvious when using these filters together with a Keyword for example in which case only results containing the keyword are being returned, the categories in the modal are displayed as disabled and cannot be deselected:
2023-07-18_19-08-33.mp4

2 Observed a minor issue where the selected descendant categories are not being highlighted:

1.Subcategory.selection.mp4
  1. I've reported separately an issue about the Language filter: Explore libraries - The applied language filter and the 'Clear all' option are missing #10989

@rtibbles
Copy link
Member Author

For 1) as I mentioned above:

I am very sure that the bug that is the root cause of the OR behaviour noted in #10975 is present in Studio, even if it is not manifesting (probably because of differences in Library content).

So, this should be functioning correctly now for everything except Studio, and we can port the fix for that to Studio as well.

2 is what I was meant to be implementing here, so I'll fix that within the scope of this PR.

I've self assigned 3, but we can deal with it separately.

@rtibbles
Copy link
Member Author

Perhaps it's worth discussing and specifying the expected behavior for the Categories and Activities filters as it's different from the rest (we are adding up results and not excluding).

This was never intended behaviour, it just hadn't manifested previously because a) we didn't have multiple learning activities for individual resources, and b) category selection before this PR cleared previous category selections.

I think maintaining consistent 'exclusion' filtering - so a resource needs every applied filter to appear seems like the right way to go for now. We can potentially add interactions to allow more advanced OR filtering in the future. This is how it should be functioning for local filtering and filtering on a peer running this code now, just remains for the port to Studio to have this happen universally.

@rtibbles
Copy link
Member Author

OK, the bug should be fixed, and in collaboration with @jtamiace I have attempted to update the category modal interface closer to the original spec - removing sub category indentation and using bolding instead:

image

import NotificationsRoot from 'kolibri.coreVue.components.NotificationsRoot';
import { PageNames } from '../constants';
import plugin_data from 'plugin_data';
import { PageNames } from '../constants';
Copy link
Member

Choose a reason for hiding this comment

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

is this just from linting?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, for reasons I couldn't discern, linting changed its mind while I was making this PR and decided to move things around.

Copy link
Member

@pcenov pcenov left a comment

Choose a reason for hiding this comment

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

Implemented as specified and looks great! No new issues observed.

Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

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

Filtering now looks much better, good to go! 🎉 💯 :shipit:

Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

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

I think this is good to merge! I added one comment re: button styling but it's for the designers. Thanks for all the cleanup here.


<section
<component
:is="windowIsLarge ? 'section' : 'SidePanelModal'"
Copy link
Member

Choose a reason for hiding this comment

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

I like this. It is probably something we (or at least I )can make use of more often

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, the alternative pattern that was being used was for the main body of the component to be in a child component and then use a v-if on the different potential parent components.

This method is a little more concise, but does mean that for the section tag it has a bunch of random meaningless attributes that should only be passed to the SidePanelModal component.

borderStyle: 'solid',
borderRadius: '4px',
};
const appearanceOverrides = {
Copy link
Member

Choose a reason for hiding this comment

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

This is a more general thought, but there are quite a few places in the hybrid learning work where we are doing a pretty "unique" variation on our KButton that requires a lot of overrides. Might be worth considering if we want a core button style in the KButton upgrades to cover this when we do the updates for that component, or if we want to just continue this way as needed and essenitally swap the colors @jtamiace @tomiwaoLE

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it might be worth revisiting the API of KButton at a minimum to see if there's a more natural way to apply this kind of styling.

// navigates the main page to the search view
if (this.topic) {
const query = { ...this.$route.query };
delete query.dropdown;
Copy link
Member

Choose a reason for hiding this comment

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

I have no recollection as to why I even added this in the first place!

Copy link
Member Author

Choose a reason for hiding this comment

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

It was because we used to have a query parameter that determined whether the side panel state was toggled open, I think? Then we refactored it to rely on component JS state, but this was never cleaned up.

Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

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

I think this is good to merge! I added one comment re: button styling but it's for the designers. Thanks for all the cleanup here.

@marcellamaki marcellamaki merged commit 1ea6137 into learningequality:develop Jul 19, 2023
@rtibbles rtibbles deleted the remote_browsing_filters branch July 19, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... SIZE: large

Projects

None yet

4 participants