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

#3190: Heading refactor and other CSS fixes - [RJM] #3358

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

rachidatecs
Copy link
Contributor

@rachidatecs rachidatecs commented Jan 16, 2025

Ticket

Resolves #3190

This was a collaboration with @gabydisarli. We primarily set out to fix headers across the app, but ended up fixing some minor issues along the way. Also, the header refactor touched some components a bit more than others, like summary items.

Changes

  • Refactor headers
  • Fix icons in buttons and links
  • Summary box color consolidation

Context for reviewers

  • Summary items code was heavily affected by the refactors

New CSS writing rules

Not sure whether this goes into documentation somewhere, but this is something anyone working on templates and CSS should know:

  • We only override margins (and in some instances padding) on headers using USWDS utility classes. We do not override colors, font size, or line height. We do not create custom classes that do so. We do not use CSS specificity to do so.
  • On headers, we now have classes .h1, .h2 .h3 and .h4 in case you semantically need a, eg, h3 but you want it to look like an h4.

Setup

Code Review Verification Steps

As the original developer, I have

Satisfied acceptance criteria and met development standards

  • Met the acceptance criteria, or will meet them in a subsequent PR
  • Created/modified automated tests
  • Update documentation in READMEs and/or onboarding guide

Ensured code standards are met (Original Developer)

  • If any updated dependencies on Pipfile, also update dependencies in requirements.txt.
  • Interactions with external systems are wrapped in try/except
  • Error handling exists for unusual or missing values

Validated user-facing changes (if applicable)

  • Tag @dotgov-designers in this PR's Reviewers for design review. If code is not user-facing, delete design reviewer checklist
  • Verify new pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
  • Checked keyboard navigability
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)

As a code reviewer, I have

Reviewed, tested, and left feedback about the changes

  • Pulled this branch locally and tested it
  • Verified code meets all checks above. Address any checks that are not satisfied
  • Reviewed this code and left comments. Indicate if comments must be addressed before code is merged
  • Checked that all code is adequately covered by tests
  • Verify migrations are valid and do not conflict with existing migrations

Validated user-facing changes as a developer

Note: Multiple code reviewers can share the checklists above, a second reviewer should not make a duplicate checklist. All checks should be checked before approving, even those labeled N/A.

  • New pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
  • Checked keyboard navigability
  • Meets all designs and user flows provided by design/product
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
  • (Rarely needed) Tested as both an analyst and applicant user

As a designer reviewer, I have

Verified that the changes match the design intention

  • Checked that the design translated visually
  • Checked behavior. Comment any found issues or broken flows.
  • Checked different states (empty, one, some, error)
  • Checked for landmarks, page heading structure, and links

Validated user-facing changes as a designer

  • Checked keyboard navigability
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
  • Tested with multiple browsers (check off which ones were used)
    • Chrome
    • Microsoft Edge
    • FireFox
    • Safari
  • (Rarely needed) Tested as both an analyst and applicant user

References

Screenshots

This is not a comprehensive list of changes:

Icons before:

Screenshot 2025-01-16 at 5 28 50 PM Screenshot 2025-01-16 at 5 29 43 PM

Icons after:

Screenshot 2025-01-16 at 5 31 56 PM Screenshot 2025-01-16 at 5 29 27 PM

Manage request before:

Screenshot 2025-01-16 at 5 39 44 PM

Manage request after (matches manage Domain):

Screenshot 2025-01-16 at 5 39 48 PM

Copy link

🥳 Successfully deployed to developer sandbox rjm.

@gabydisarli
Copy link
Contributor

Hey @rachidatecs I actually had someone change all the icons to the smaller size a while ago (I Can't remember what PR it was). I'd like to keep them small. Is that possible?

@@ -46,7 +46,7 @@
{% endwith %}

{% if domain_request.alternative_domains.all %}
<h3 class="header--body text-primary-dark margin-bottom-0">Alternative domains</h3>
<h3 class="h4 margin-bottom-0">Alternative domains</h3>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems really counter-intuitive. If I didn't read through the css, I would want to "correct" this so we are using h4 for the element instead of as a class for an h3 element....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pattern I learned from Bootstrap. Just remember that the DOM element is driven by semantics while the CSS class is presentational.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So any dev's thought process should be:
1- What should this header be? It's a new section and the parent section starts with a h2, so h3 makes the most sense
2- Now that I have chosen h3, I want it to look like an h4. Instead of messing with custom class names like we used to, font size and font weight and line height styles or utility classes, simply use class h4 - again, CSS classes are presentational

For more, read through the first part of this Bootstrap documentation page

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rachidatecs I know we talked about this but, this could be a good example to use for that new documentation/guidance we'd like to share on how semantic use of headings vs visual.

@@ -132,8 +132,8 @@ <h3 class="header--body text-primary-dark margin-bottom-0">Alternative domains</
{% with title=form_titles|get_item:step %}
{% if domain_request.has_additional_details %}
{% include "includes/summary_item.html" with title="Additional Details" value=" " heading_level=heading_level editable=is_editable edit_link=domain_request_url %}
<h3 class="header--body text-primary-dark margin-bottom-0">CISA Regional Representative</h3>
<ul class="usa-list usa-list--unstyled margin-top-0">
<h4 class="margin-bottom-0">CISA Regional Representative</h4>
Copy link
Contributor

@CocoByte CocoByte Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ This is the change I REALLY want to do for the <h3 class="h4...> elements...

Copy link
Contributor

@CocoByte CocoByte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what is happening and OVERALL, I like it alot.....except for one area that I am sure you have your reasons for, but I left a couple comments anyway.

Copy link

🥳 Successfully deployed to developer sandbox rjm.

Copy link

🥳 Successfully deployed to developer sandbox rjm.

@CocoByte CocoByte self-assigned this Jan 17, 2025
Copy link
Contributor

@CocoByte CocoByte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good huddle today. Great demo presentation. I see the changes. LGTM

@gabydisarli
Copy link
Contributor

gabydisarli commented Jan 22, 2025

@rachidatecs H1 - seeing wrong font-size (2.13rem). We normalized to 2.125rem so that the px number is 34px. Can we update h1 font-size to 2.125 rem?

Copy link
Contributor

@gabydisarli gabydisarli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conditionally approve with requested changes. Will you let me know what you end up doing with the summary box heading? I think the heading should look more like the Preamble than the DNSSEC version (bold).

@gabydisarli
Copy link
Contributor

I think there's something funky still going on with the summary box component. I understand we have limitations here because of what USWDS does. But when comparing the headings of the summary box on the DNSSEC enabled page to the summary box on the Preamble, they seem very different. I thought we wanted to make them appear the same even if semantically we need to use another level. (See screenshots)
screencapture-getgov-rjm-app-cloud-gov-domain-389-dns-dnssec-2025-01-21-17_04_10
screencapture-getgov-rjm-app-cloud-gov-request-start-2025-01-21-17_03_53

@rachidatecs rachidatecs changed the title #3190: Heading refactor and other CSS fixes #3190: Heading refactor and other CSS fixes - [RJM] Jan 22, 2025
@rachidatecs
Copy link
Contributor Author

@rachidatecs H1 - seeing wrong font-size (2.13rem). We normalized to 2.125rem so that the px number is 34px. Can we update h1 font-size to 2.125 rem?

I traced this to browser rounding: "Browsers prioritize rendering performance over extremely precise decimal calculation"

Copy link

🥳 Successfully deployed to developer sandbox rjm.

@rachidatecs
Copy link
Contributor Author

I think there's something funky still going on with the summary box component. I understand we have limitations here because of what USWDS does. But when comparing the headings of the summary box on the DNSSEC enabled page to the summary box on the Preamble, they seem very different. I thought we wanted to make them appear the same even if semantically we need to use another level. (See screenshots) ...

Fixed. USWDS summary box header styles excluded font-weight, I normalized it to bold.

Copy link

🥳 Successfully deployed to developer sandbox rjm.

Copy link
Contributor

@gabydisarli gabydisarli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Copy link

🥳 Successfully deployed to developer sandbox rjm.

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

Successfully merging this pull request may close these issues.

Update heading styles
3 participants