diff --git a/.changeset/friendly-buses-thank.md b/.changeset/friendly-buses-thank.md new file mode 100644 index 0000000000..edf77cd340 --- /dev/null +++ b/.changeset/friendly-buses-thank.md @@ -0,0 +1,5 @@ +--- +"@primer/view-components": patch +--- + +Bug fix: Text field validation wrap styles diff --git a/app/components/primer/alpha/form_control.html.erb b/app/components/primer/alpha/form_control.html.erb index 7784c0648c..003ca2fd30 100644 --- a/app/components/primer/alpha/form_control.html.erb +++ b/app/components/primer/alpha/form_control.html.erb @@ -10,7 +10,7 @@ <% end %> <% if @validation_message %> <%= render(Primer::BaseComponent.new(tag: :div, **@validation_arguments)) do %> - <%= render(Primer::Beta::Octicon.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %> + <%= render(Primer::Beta::Octicon.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %> <%= @validation_message %> <% end %> <% end %> diff --git a/app/components/primer/alpha/text_field.pcss b/app/components/primer/alpha/text_field.pcss index 945fea5ce8..5823e453dc 100644 --- a/app/components/primer/alpha/text_field.pcss +++ b/app/components/primer/alpha/text_field.pcss @@ -34,11 +34,12 @@ .FormControl-inlineValidation { display: flex; font-size: var(--text-caption-size, 12px); + line-height: var(--text-caption-lineHeight, calc(16 / 12)); font-weight: var(--base-text-weight-semibold, 600); color: var(--color-danger-fg); fill: var(--color-danger-fg); flex-direction: row; - align-items: center; + align-items: start; gap: var(--base-size-4, 4px); & p { @@ -46,6 +47,12 @@ } } +.FormControl-inlineValidation--visual { + align-items: center; + display: flex; + min-height: var(--base-size-16, 16px); +} + .FormControl-spacingWrapper { display: flex; flex-direction: column; diff --git a/lib/primer/forms/form_control.html.erb b/lib/primer/forms/form_control.html.erb index 8dd9259566..71269ec311 100644 --- a/lib/primer/forms/form_control.html.erb +++ b/lib/primer/forms/form_control.html.erb @@ -10,7 +10,7 @@ <% end %> <%= content %> <%= content_tag(:div, **@input.validation_arguments) do %> - <%= render(Primer::Beta::Octicon.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %> + <%= render(Primer::Beta::Octicon.new(icon: :"alert-fill", size: :xsmall, aria: { hidden: true })) %> <%= content_tag(:span, @input.invalid? ? @input.validation_messages.first : "", **@input.validation_message_arguments) %> <% end %> <%= render(Caption.new(input: @input)) %>