-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Data view: Search & Filtering #55100
Comments
This comment was marked as outdated.
This comment was marked as outdated.
@jameskoster I've added a new section for tracking specific tasks. Thoughts/Questions about some tasks in the backlog:
I can start working on resetting all filters based on this design while we answer/unblock these questions. |
Yeah, absolutely. We need to figure out the preset => before/after conversion, but it seems doable. Looking at the existing components, I see a DatePicker, a TimePicker and a DateTimePicker, but they do not work with ranges – the sooner we have a design, the better, so we can update them / create new ones as necessary. I am also thinking that date presets need to be contextual to the dataset. There may be scenarios where shorter ranges are useful ('last hour' or 'today'), like for a store or a news site. Initially, we could offer some that cover a wide surface, and look at making them configurable per page/dataset if necessary. |
#55270 implements the ability to show/hide filters. |
#56110 starts implementing the new filter component. |
Just a note to say that the datepicker design might take some time to get right, given all the permutations. Until then, perhaps for date filtering we simply seek parity with wp-admin, IE filter by month. Hopefully that's simple to do with the current components? |
PR for implementing multi-selection in filter #56468 (also updated a bit the issue description with latest progress) |
PR implementing |
Following on from the recent updates to the List layout, we need to reduce the width of the data view column. But before we can do that, we need a solution for displaying and managing filters in smaller areas. Filter labels can get quite long, and while wrapping is okay, it might not be the best solution: An alternative approach could be to hide the filter dropdowns in smaller areas, and make filters manageable in the main filter menu: Note how the Author filter remains visible in the menu even after it's been added. In List layout, and other layouts on mobile devices this would work like so: In the absence of the filter dropdowns, a small count ensures that it's easy to tell at a glance whether filters have been applied. |
First step to offer a more condense filter affordance at #56983 |
IMO this is a better UX. It also allows us to have better semantics, by keeping menu stuff in We'll still probably have to go with a "custom" implementation for the popover, which will include:
Curious to hear @andrewhayward and @diegohaz 's thoughts too. |
This is a much improved direction, from a UX perspective; I was starting to get a bit worried that everything was going to be a menu! We'll need to think a bit about how users interact with these, at a high level. For example, what happens if you + Add filter then immediately hit Similarly, what happens if the filter is already active and the user hits The same applies for Reset too, but that's an even more explicit action. What does it reset the filter to? |
What @ciampo said seems about right to me; essentially a non-modal dialog positioned next to the relevant filter button. We should be able to make a base filter implementation that handles the basics, and ensures a consistent experience; something like this brain-dump of pseudo-ish code... function Filter ( props ) {
const focusRef = useRef();
const [ isExpanded, setIsExpanded ] = useState( false );
const toggleIsExpanded = () => setIsExpanded(( expanded ) => ! expanded );
const { title, activeCondition, values } = props;
useEffect(() => {
if ( isExpanded && focusRef.current ) {
focusRef.current.focus();
}
}, [ isExpanded, focusRef ] );
return (
<PopoverButton isExpanded={ isExpanded } onClick={ toggleIsExpanded }>
{ `${ title } ${ activeCondition }: ${ values }` }
{ isExpanded && (
<FilterPopover { ...props } ref={ focusRef } />
) }
</PopoverButton>
);
}
const FilterPopover = forwardRef(
function FilterPopover ( { render, ...props }, ref ) {
const { title, conditions, activeCondition } = props;
return (
<Popover>
{ title } <Select values={ conditions } selectedValue={ activeCondition } />
{ render( props, ref ) }
<Button onClick={ ... }>Reset</Button>
</Popover>
);
}
); function TextFilter ( props ) {
return (
<Filter { ...props } render={ ( props, ref ) => (
<TextInput { ...props } ref={ ref } />
) } />
);
}
function ListFilter ( props ) {
return (
<Filter { ...props } render={ ( props, ref ) => (
<ComboBox { ...props } ref={ ref } />
) } />
);
}
function DateFilter ( props ) {
return (
<Filter { ...props } render={ ( props, ref ) => (
<DatePicker { ...props } ref={ ref } />
) } />
);
} We'll also have think about how translation works here; for example, |
Good question. On the surface the latter seems more helpful, but if you're someone who wants to add filters before configuring them it might be unexpected/frustrating? Perhaps it's best (and probably simplest) to start with consistency. So regardless of whether you just added the filter, or added it previously an re-opened the configuration popover, pressing escape would close the popover and transfer focus to the trigger. As for saving, the changes would occur "live", so in effect there's nothing to discard or apply on close. |
+1 on this approach @jameskoster . It also aligns better with the idea of primary filters that are always visible for quick access but may be empty. We could still condense into a single dropdown on smaller containers. |
I've started working on the redesign and hopefully very soon will have a PR. |
#59610 implements multi-selection for filters. |
@jameskoster is there any design for filters of type "open text"? This is, filters that don't have a preselection of values. At the moment, this is done via the global search, though we may want to have a dedicated filter for that with support for operators such as "Starts with...", "Ends with...", "Contains..." (the current global search). |
What's the relation between this new filter and the "global search"? The global search is quite opaque in that the user doesn't know the fields or operators that it uses. I wonder if both should be connected. |
#59953 adds support for |
Part of #55083
This ticket is a stub to include designs for search & filtering in tables. Considerations that could affect the design include:
Iterations
Support pages, templates, and template parts pages.
DataViews component
selectlist
.ENUMERATION
field. Target design. @oandregalSelectControl
. #55270DropdownMenu
. Same UI in top-level & columns. #56110NOT IN
operation. Design. #56479AND
&OR
. Needs design.DATE
field. Starting design.TEXT
field. Needs design.The text was updated successfully, but these errors were encountered: