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

Fixes #9824 - Filtering in block picker doesn't work #9831

Merged

Conversation

bjarnef
Copy link
Contributor

@bjarnef bjarnef commented Feb 17, 2021

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes #9824

Description

Currently the block picker is showing filter, when enough blocks are available. However the filtering didn't work.
Furthermore when opening the block picker it was scrolling down to last block, because the auto focus set here was stealing focus from the filter. Event worse when start typing in the search input you suddently lost focus, probably because the filtered results now changes the indexes and the umb-auto-focus watched these block cards. For now I have removing the, but we can always add it again, when we fix this. For now it works better without the auto focus on the block cards. f6a3168

I have furthermore cleaner up using <umb-editor-container> instead of all the hardcoded classes and also replaced the search filter with <umb-search-filter> component.

Finally I have fixed the filtering, so it now works correctly.

ib4ESEeHm5

However I noticed it didn't seems to filter the image block correctly. I named the alias of this blockImage since a document type with alias image was already in use.

image

Strange enough it does filter the blocks in searching block or a rename the alias picture and search on picture.

@bjarnef
Copy link
Contributor Author

bjarnef commented Feb 17, 2021

Actually for the last part I think it is because the blocks contains a property backgroundImage which contain the word image. We should probably specify specific properties to search in.

We might need to add a custom filter to better handle filtering on blocks:
https://stackoverflow.com/a/31510239

@nathanwoulfe @nielslyngsoe @madsrasmussen do you have a suggestion to handle this so filter on "image" actually returns blocks containing "Image" in name and not all blocks. Maybe we also want to search alias property, but searching id and key/guid is probably not that important from an editors point of view. More important that "Image" doesn't return all blocks, but we can add these changes in a new PR.

This could work if we only need to search a single property:
filter: { name: vm.filter.searchTerm }

but for more properties we need to handle this in the controller or use a custom filter.

@nul800sebastiaan
Copy link
Member

Thanks @bjarnef - so far, so good! I'll put the last comment on the list to discuss at HQ, it's an interesting point!

@nul800sebastiaan nul800sebastiaan changed the title Block picker filtering Fixes #9824 - Filtering in block picker doesn't work Feb 21, 2021
@nul800sebastiaan nul800sebastiaan merged commit 82701fb into umbraco:v8/contrib Feb 21, 2021
@bjarnef bjarnef deleted the v8/bug/block-picker-filtering branch February 21, 2021 11:44
@bjarnef bjarnef mentioned this pull request Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filtering in block picker doesn't work
2 participants