Address HTML markup issues reported by Herb#6804
Conversation
| <tr style="box-sizing: border-box;"> | ||
| <td class="cell c1776" style="box-sizing: border-box; width: 70%; vertical-align: middle;text-align:center;" width="70%" valign="middle"> | ||
| <img style="max-width: 100%;" src="https://user-images.githubusercontent.com/8918762/120879374-7c813a00-c588-11eb-92d7-efa6fdfdfbf0.png" alt="Logo" class="c926" style="box-sizing: border-box; color: rgb(158, 83, 129); font-size: 50px;padding-top:10px;background:#00447c;"> | ||
| <img src="https://user-images.githubusercontent.com/8918762/120879374-7c813a00-c588-11eb-92d7-efa6fdfdfbf0.png" alt="Logo" class="c926" style="max-width: 100%; box-sizing: border-box; color: rgb(158, 83, 129); font-size: 50px;padding-top:10px;background:#00447c;"> |
There was a problem hiding this comment.
Previously, there were two style attributes. I now merged the first one into the second one.
Technically this could have some side-effects as browsers (and email clients) usually ignore the second attribute with the same name.
compwron
left a comment
There was a problem hiding this comment.
lgtm! Hmm herb looks interesting... open a separate pr and swap it for erb/haml lint?
There was a problem hiding this comment.
Pull request overview
This PR fixes invalid/mismatched HTML/ERB markup across public error pages and multiple Rails views/partials to satisfy Herb’s HTML validity checks and ensure the app renders structurally valid HTML.
Changes:
- Fix mismatched/incorrect closing tags and mis-nested block elements across views/partials and public error pages.
- Replace invalid ERB output usage in attribute positions with valid conditional/structured markup.
- Clean up a few redundant/empty attributes and invalid tag constructs (e.g., duplicate closing tags, duplicate
style).
Reviewed changes
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| public/500.html | Fix invalid closing tag in footer copyright block. |
| public/404.html | Fix invalid closing tag in footer copyright block. |
| app/views/volunteers/index.html.erb | Remove extra/mismatched closing divs to balance layout structure. |
| app/views/users/edit.html.erb | Adjust closing div placement to correct markup nesting. |
| app/views/supervisors/index.html.erb | Fix div nesting/closure around the table/empty-state block. |
| app/views/supervisors/_manage_active.html.erb | Correct closing div placement for the outer wrapper. |
| app/views/shared/_manage_volunteers.html.erb | Replace invalid ERB attribute interpolation with valid conditional disabled attribute. |
| app/views/other_duties/index.html.erb | Add missing table row <tr> opening tag for each duty row. |
| app/views/learning_hours/_confirm_note.html.erb | Replace invalid <p> wrapper containing block elements with a <div>. |
| app/views/layouts/_banner.html.erb | Remove empty class="" attribute. |
| app/views/layouts/_all_casa_admin_sidebar.html.erb | Remove stray <li> that caused invalid list structure. |
| app/views/imports/_volunteers.html.erb | Fix wrapper div closure around the import form section. |
| app/views/imports/_supervisors.html.erb | Fix wrapper div closure around the import form section. |
| app/views/imports/_sms_opt_in_modal.html.erb | Fix mismatched <span> closing tag. |
| app/views/imports/_cases.html.erb | Fix wrapper div closure around the import form section. |
| app/views/emancipations/show.html.erb | Refactor inputs to avoid invalid ERB-in-attribute markup (but introduces a functional issue: disabled used instead of checked). |
| app/views/devise/sessions/new.html.erb | Fix mismatched closing divs around the login button/form layout. |
| app/views/devise/mailer/reset_password_instructions.html.erb | Remove duplicate style attribute from <img>. |
| app/views/devise/invitations/edit.html.erb | Remove an extra </i> closing tag. |
| app/views/case_contacts/_followup.html.erb | Simplify conditional markup to avoid mismatched wrapper divs. |
| app/views/case_contacts/_confirm_note_content_dialog.html.erb | Replace invalid <p> wrapper containing block elements with a <div>. |
| app/views/case_contacts/_case_contact.html.erb | Remove empty class="" attribute. |
| app/views/casa_org/_languages.html.erb | Add missing closing div to balance outer layout wrappers. |
| app/views/casa_cases/show.html.erb | Replace invalid <p> wrappers around headings with <div> blocks. |
| app/views/casa_cases/_court_dates.html.erb | Replace invalid <p> inside <ul> with <li> elements. |
| app/views/casa_cases/_calendar_button.html.erb | Remove empty block form of tag.div and render the div directly. |
| app/views/casa_admins/index.html.erb | Remove empty class="" attribute from table row. |
| app/views/all_casa_admins/patch_notes/_patch_note.html.erb | Simplify <option> rendering while keeping correct selected behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for the quick merge @compwron! 🙏🏼 |
What github issue is this PR for, if any?
N/A
What changed, and why?
This pull request addresses the HTML markup issues reported by the Herb gem. I was testing my gem against real applications and thought I'd send a pull request addressing the markup issues I found in return 🙈
The issues were mismatched opening/closing tags, block elements (
<h6>,<div>) incorrectly nested inside<p>tags, ERB output tags (<%= %>) used in HTML attribute position, and a few typos like</class>instead of</p>in the public error pages. No logic changes, just structural HTML fixes to have the server render valid HTML.How is this tested?
With the
herbgem installed, you can runherb analyze. It now reports 240/240 files clean. All changes should preserve the same rendered output so existing tests should be unaffected, but let me know if you want me to add some specific tests.I also saw you are runnig Better HTML and ERB Lint, so I didn't want to just add Herb. These markup fixes are also working without Herb so I left it out for now. But more than happy to add it as a dependency and set it up to run as part of CI, either in this PR or in a follow up 🙌🏼
Screenshots
Feelings gif