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

WIP: Added a plugin to filter a list of elements #7816

Closed
wants to merge 3 commits into from
Closed

WIP: Added a plugin to filter a list of elements #7816

wants to merge 3 commits into from

Conversation

LaurentGoderre
Copy link
Member

@LaurentGoderre LaurentGoderre commented Dec 20, 2016

TODO:

  • Add i18n
  • Add String.prototype.normalize polyfill
  • Add demo
  • Add documentation

@LaurentGoderre LaurentGoderre changed the title Added a plugin to filter a list of elements WIP: Added a plugin to filter a list of elements Dec 20, 2016
@nschonni
Copy link
Member

I'm wondering if this needs to be in an aria-live region

@LaurentGoderre
Copy link
Member Author

@nschonni I don't think so since no new content is added. Only hidden. The typical flow for a user would be to type in a filter than navigate below in what is left. Of course I plan to get this tested though

@duboisp
Copy link
Member

duboisp commented Dec 20, 2016

@LaurentGoderre what do you think if I add that feature to my PR #7790.

Base on your (this) PR, I could add a list filtering feature something similar of what I did for table filtering.

What do you think of filtering by using a datalist? I can add that rendering option in Field flow.

aside: what is the signification of "WIP"?

@LaurentGoderre
Copy link
Member Author

@duboisp let's ensure that they are compatible but I don't think they should be the same, because this one allows to filter anyone as long as it can be expressed by CSS selectors.

WIP is work in progress

@duboisp
Copy link
Member

duboisp commented Dec 20, 2016

I agree they should not be the same. I was thinking to add a new "action" called "lstfilter" in wb-fieldflow where it will specifically deal with list filtering. I only wanted to highlight the feature similarity.

Field flow already deal with the UI.

I will work on a demo but I may only able to only deliver in about 3-4 weeks.

@LaurentGoderre
Copy link
Member Author

I don't think I'm in too much rush but I think I'll have to implement this locally until this lands. I still want ours to be a reflection of what will eventually land.

@duboisp
Copy link
Member

duboisp commented Dec 20, 2016

@LaurentGoderre what kind of user interaction do you need

  1. The user type in the data list then click a button "filter" to filter the list. (Here field flow could do a great job, it could allow to filter with multiple criteria and filter with per-determined criteria)
    or
  2. The user just type directly in a textbox then the list are filtered live. (Here a new plugin could better fit the need)

@LaurentGoderre
Copy link
Member Author

THis allows to filter simply by typing and allows to filter any type of content, not just lists.

@LaurentGoderre
Copy link
Member Author

@duboisp I don't think our plugins aim at doing the same thing.

@duboisp
Copy link
Member

duboisp commented Dec 21, 2016

@LaurentGoderre ok

So you are looking to do something similar like : https://github.com/javve/list.js - http://listjs.com/

@LaurentGoderre
Copy link
Member Author

Yep.

@LaurentGoderre
Copy link
Member Author

@pcwsmith if I recall correctly, you needed something like this for Cannada.ca as well didn't you?

( function() {
window[ "wb-filter" ] = {
filterCallback: function( $field, $elm, settings ) {
var $sections = $elm.find( "section" ),
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion:
Include that call back directly in the plugin instead. I think it is common to deal with grouping.

So, instead of targeting directly the section that could be set through config like:

<div class="wb-filter" data-wb-filter='{"group": "section"}'>
   [...]
</div>

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 suppose we can have one or more default ones but I'm not sure it will be that simple in many cases. Because this can target any content using selectors. I'm trying to be as least opinionated as possible.

Copy link
Member

Choose a reason for hiding this comment

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

You can still allow to use a custom callback for those complex case.

Is triggering a event could be better than using a call back?

Copy link
Member Author

Choose a reason for hiding this comment

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

Better than a callback no. More WET4....maybe. However, the next version of WET needs to shift to using more callback as it's a way more common pattern in the JS world.

@pcwsmith
Copy link

indeed we have included filter tools for lists in our design patterns for Canada.ca, been hoping that it could get made.

@duboisp duboisp added this to the v4.0.24 milestone Jan 13, 2017
@duboisp duboisp added Query: Feature Request State: Work in progress Represent an issue that its progression are reported frequently. labels Jan 13, 2017
@duboisp duboisp mentioned this pull request Feb 3, 2017
@eswright
Copy link

I see this as a very important development to deter pages of lists being written as tables to meet usability requirements.

@DK-TBS
Copy link

DK-TBS commented Apr 5, 2017

Hi gang! How close are we to having a first version of this plugin up and running? Any chance I can see a demo of this thing in action?

The C&IA team here is very keen on this one, we need it for a couple of different page templates. If the main problem is a lack of manpower to push it across the finish line, perhaps we could help by tracking down a volunteer? We don't have the skils on our team to actively contribute, but if there's any other way we can help, we would jump at the chance :)

@LaurentGoderre
Copy link
Member Author

@SBleeks can you add your comments of what needs to be fixed accessibility wise for this component?

@SBleeks
Copy link
Member

SBleeks commented Apr 5, 2017

I can't find a link to the current design here? Can you send me the link?

@LaurentGoderre
Copy link
Member Author

@duboisp duboisp mentioned this pull request Jul 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Query: Feature Request State: Work in progress Represent an issue that its progression are reported frequently.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants