Skip to content

Form Validation: Increase $form-feedback-font-size to make .invalid-feedback larger#41488

Closed
ThomasLandauer wants to merge 2 commits into
twbs:mainfrom
ThomasLandauer:patch-1
Closed

Form Validation: Increase $form-feedback-font-size to make .invalid-feedback larger#41488
ThomasLandauer wants to merge 2 commits into
twbs:mainfrom
ThomasLandauer:patch-1

Conversation

@ThomasLandauer
Copy link
Copy Markdown
Contributor

@ThomasLandauer ThomasLandauer commented May 23, 2025

Description

Increase the font-size of .invalid-feedback to the regular body font size (which I guess is $font-size-base).

Motivation & Context

Although common, it's actually weird to display error messages in smaller font size, cause:

  • When an error message is present, this is the most important text on the entire page In this case, visual appeal is less important than a legible message informing the user what actually is wrong with their input.
  • Most of the time the error message isn't shown at all (especially when initially loading the page), so it doesn't hinder the page's overall appeal.

I'm aware that this also affects .valid-feedback. This is OK for me (positive feedback should be legible as well), but maybe it would be better to introduce separate font size variables for .valid and .invalid.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

https://deploy-preview-41488--twbs-bootstrap.netlify.app/docs/5.3/forms/validation/#server-side

…d-feedback` larger

## What I'm trying to achieve
Increase the `font-size` of `.invalid-feedback` to the regular body font size (which I guess is `$font-size-base`).

## Why
Although common, it's actually weird to display error messages in smaller font size, cause:
* **When an error message is present, this is the most important text on the entire page** In this case, visual appeal is less important than a legible message informing the user what actually is wrong with their input.
* Most of the time the error message isn't shown at all (especially when initially loading the page), so it doesn't hinder the page's overall appeal.

I'm aware that this also affects `.valid-feedback`. This is OK for me (positive feedback should be legible as well), but maybe it would be better to introduce separate font size variables for `.valid` and `.invalid`.
@julien-deramond
Copy link
Copy Markdown
Member

I don't have a strong opinion on the default size of this element, but any change here would need to wait until the next minor version in terms of impacts for projects.

That said, with our current implementation, there are maybe some accessibility concerns. Addressing them might require additional changes.

While our current styling isn't ideal in some cases like the following, the slightly different font size at least provides a visual distinction beyond color, helping users understand that this is an error message, separate from the label and form control:

Screenshot 2025-05-23 at 13 50 41

With the proposed change in this PR, we're relying in this case almost entirely on color, which makes it even harder to recognize this as an error message IMHO:

Screenshot 2025-05-23 at 13 52 26

Let's have some feedback in terms of design from @mdo and accessibility from @patrickhlauke :)

@patrickhlauke patrickhlauke self-assigned this May 23, 2025
@ThomasLandauer
Copy link
Copy Markdown
Contributor Author

While our current styling isn't ideal in some cases like the following, the slightly different font size at least provides a visual distinction beyond color, helping users understand that this is an error message, separate from the label and form control:

Indeed, that's right. Maybe set the -feedback classes in italics?

@patrickhlauke
Copy link
Copy Markdown
Member

have to admit that personally i prefer the smaller ones we currently have. i don't think they're so massively small that they are difficult to spot/read

@mdo
Copy link
Copy Markdown
Member

mdo commented May 26, 2025

Agreed with Patrick, going to close out for now.

@mdo mdo closed this May 26, 2025
@github-project-automation github-project-automation Bot moved this from Needs review to Done in v5.4.0 May 26, 2025
@mdo mdo removed this from v5.4.0 May 26, 2025
@ThomasLandauer ThomasLandauer deleted the patch-1 branch May 26, 2025 23:07
@ThomasLandauer ThomasLandauer restored the patch-1 branch May 26, 2025 23:07
@ThomasLandauer ThomasLandauer deleted the patch-1 branch May 26, 2025 23:07
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.

4 participants