-
Notifications
You must be signed in to change notification settings - Fork 343
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
Search Results: Hide this web part if there's nothing to show: removes padding and margins #3850
Comments
Hi, |
Hi, |
I suspect we need to add a check if a web part header is set - then don't remove padding. @Lou-i3 if there are no results, do you want the web part title to show or be hidden? And your screenshots says "10508 results", which means there are results? Can you add some more detail into what scenario you have or not? The idea is that if there are 0 results, don't render anything in the webpart and don't take up any padding space - similar to if the web part was not on the page at all. That is the intention of the setting. |
@Lou-i3 if you have a web part title, and there is no content, then the web part title should also be hidden - would that be the correct fix? |
@wobba yes if there is no content, the web part should be completely hidden, title hidden too. My screenshot showed a lot of results because I just made an example for the screenshot. |
@wobba I just checked this and figured out, what behaviour @Lou-i3 means: Solution would be only to remove padding and margin, if there are no results - and not just if the setting is set to TRUE. I will check the code and try to fix it. |
@jblueml I see the issue in the code as you say.... web part removed padding based on the toggle only, not on the results coming back. Curious why I made it this way 😅 |
Fixed by #3867 in the dev branch and will part of the next release. |
Follow the template below or we will have to delete this request!!
Version used
Ex: 4.12.2
Describe the bug
On the PnP Search Result web part, when the "Hide this web part if there's nothing to show" parameter is enabled, the padding and margin of the web part are broken.
When this setting is enabled on the WebPart, inspecting the DOM reveals that the div with data-automation-id="CanvasControl" wrapping the results has an inline style set to:
padding-top: 0px; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px;
.To Reproduce
Detailed steps to reproduce the behavior:
Expected behavior
The layout of the web part should be the same wether this parameter is on or off.
Screenshots
See screenshot, comparing with the setting off (left) and on (right):
Desktop (please complete the following information):
Additional context
I tried with different requests and different templates but always get the same behaviour.
The text was updated successfully, but these errors were encountered: