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

CSS rule hides picture upload widget in blog #522

Open
MacLake opened this issue Feb 28, 2024 · 4 comments
Open

CSS rule hides picture upload widget in blog #522

MacLake opened this issue Feb 28, 2024 · 4 comments

Comments

@MacLake
Copy link
Contributor

MacLake commented Feb 28, 2024

I use django-cms==3.11.5. With the CSS rules of djangocms-admin-style==3.3.0 the picture upload widget in the blog entries in djangocms-blog==2.0.7 are hidden.

The culprit is in djangocms_admin_style/sass/components/_forms.scss:

form {
    margin-bottom: 20px;
    padding: 25px 25px;
    background-color: $white;
    box-shadow: $base-box-shadow;
    fieldset, .inline-group {
        width: 80%;
    }

    // Newer Django admin styles use flexbox, we do not
    .flex-container {
        display: block;
        margin-right: 20px;
    }
    .flex-container.form-multiline {
        display: flex;
        margin-right: 0;
        div.fieldBox {
            display: block;
            //margin-right: 0;
        }
        div:has(div.hidden) {
            display: none;
        }
    }
/**/
}

display: none; hides the picture widget.

I have created a fix in my fork, which just removes a display: hidden; but I don’t know if it breaks anything else, because I don’t know the idea of this rule.

@fsbraun
Copy link
Member

fsbraun commented Feb 28, 2024

@MacLake Well spotted. It seems I introduced this... 🤦‍♂️ Can you create a PR?

I think this needs a more specific selector that the hidden div is a direct child of the div. Can you check if & > div:has(> div.hidden works for you?

@MacLake
Copy link
Contributor Author

MacLake commented Feb 29, 2024

Ok, instead of deleting the rule I have now inserted

        & > div:has(> div.hidden) {
            display: none;
        }

i.e. I closed the parenthesis ). Right? I never worked with SASS before, and I don’t fully understand the purpose of this rule, but for the picture upload widget in djangocms-blog it works like this. I just created a PR with this change.

@fsbraun
Copy link
Member

fsbraun commented Feb 29, 2024

The div reserves the space for an input field. If the input field is hidden, then there should not be space reserved for it. The rule is supposed to hide the div if it has a direct child, which is hidden. Unfortunately, the space-reserving div does not have a class or any other means of selecting it.

The closing parenthesis is correct. This rule only works on modern browsers, on older browsers it has no effect.

@raffael-mnhn
Copy link

Could you not use visibility: hidden? This does not remove the element from the flow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants