-
Notifications
You must be signed in to change notification settings - Fork 111
Discussion: Adding default styles for form elements #484
Comments
I've been reading through the previous discussions on this and there are a lot of good points for and against. Personally, I'm of the mind that we should have some sensible fallback styles for inputs. As Carolina mentioned, we already have some for the comment form, so the styles are there. As users have pointed out, without any styling the form elements look broken or woefully out of place against the backdrop of the otherwise beautiful design. Maybe that's just the designer in me. 🙃 This should be something we can seamlessly transition to theme.json powered styles when they are available. |
The fix for the login form is just a few lines of CSS: WordPress/gutenberg#50466 (comment) ☝ I've also shared a fix for applying the |
Since it is not a bug introduced in 6.7, I am not sure an update to login/out can be included now, even if someone was able to work on it. |
+1 for adding some fallback styles. Things to consider: The fallback is for this theme only Form plugins often bring their own styles therefore fallback should be minimal with low specificity Comment form styles should be used DiscussionsThere are already discussions/pr going on Specific CSS can be found on the post-comment-form block here and here ApproachI would add default styling with a low specificity by using the :where(textarea),
:where(select),
:where(input:not([type="submit"])) {
border: 1px solid;
font-size: 1em;
font-family: inherit;
border-radius: .25rem;
border-color: var(--wp--preset--color--accent-6);
}
:where(textarea),
:where(select),
:where(input:not([type="submit"]):not([type="checkbox"])) {
padding: calc(0.667em + 2px);
} This can be added to the style.css meanwhile until we have form elements in core
It is still not perfect but I think a good starting point to bring CSS to forms in TT5. |
What if the example from @evrpress was slightly updated to follow the style of the search block? :where(textarea),
:where(select),
:where(input:not([type="submit"])) {
border: 1px solid;
font-size: 1em;
font-family: inherit;
border-radius: 3.125rem;
border-color: var(--wp--preset--color--accent-6);
}
:where(textarea),
:where(select),
:where(input:not([type="submit"]):not([type="checkbox"])) {
padding: 0.667rem;
} |
@troychaplin I think we should stick to more standard input styles here. The fully-rounded ones can look like buttons and feel visually disconnected. I'm not an a11y expert but I think there are also some considerations there. |
The different style variations use different border radius. |
You're right, I didn't consider what this applies too, I didn't look beyond its application on the login / out block |
Anyway, I don't see any arguments against adding styles for the inputs. The only question is which styles :) |
What do you think @beafialho ? I recommend using the same styles as the comment blocks, in all style variations: The select list needs styling too, especially padding. Compare the current search block and the categories list with dropdown enabled: |
I agree @carolinan. Do we have a way to customise the category dropdown like this? On the left are the current styles, on the right is a proposal of how they could be. |
Summary:
The theme can’t style third party blocks with generic styles, because the CSS bleeds into the editor interface. There is a bug with the custom CSS field in theme.json, that results in the search block not being updated when you switch style variations. Work on select lists has not started and would be affected by the same CSS issue as above. |
Description
The Gutenberg PR to add the form inputs to theme.json elements was not completed in time for WordPress 6.7 Beta 1.
Should the theme add default styles for form inputs?
The search and comment forms are already styled.
Login/logout block is not styled: It can be improved, but needs custom CSS since the expected class names for the button style etc. is missing (this is a known issue).
Many forms in third-party plugins and custom blocks are not styled.
The text was updated successfully, but these errors were encountered: