Skip to content

Fix buttons widths from BassCSS to USWDS migration#4869

Merged
jmhooper merged 11 commits intomainfrom
aduth-fix-doc-auth-secondary-button
Apr 5, 2021
Merged

Fix buttons widths from BassCSS to USWDS migration#4869
jmhooper merged 11 commits intomainfrom
aduth-fix-doc-auth-secondary-button

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Apr 2, 2021

See: #4836

Why:

  • Design system buttons appear as full-width at small viewport widths, which was not the case previously with BassCSS buttons. While many buttons in the IdP are intended to occupy full-width on mobile, there are some which are expected to collapse to their minimum width. This was accounted for as part of LG-4226 / LG-4226: Add explicit flexible width button modifier identity-design-system#197, but wasn't incorporated into the work of LG-3865: Remove BassCSS Module: Btn #4836.
  • As part of this effort, there's a desire to improve consistency of how widths are applied to standard form button templates. @anniehirshman-gsa and myself had gone through each screen to verify the intended appearance and make changes as appropriate.

Status:

  • Track down if there are other instances where we need flexible-width buttons
  • Confirm whether there are other issues with unstyled links applying full-width by default (arguably, unstyled buttons should not ever be applying a width, but this is the default inherited from USWDS).
    • Currently in document capture, this is a problem resolved by applying width-auto utility class to the unstyled button. This was changed to render unstyled buttons as display: inline; by default.
  • Confirm whether there are other issues with unstyled links overriding margin and padding conflicting with utility classes.
    • Currently in document capture, this is a problem resolved by using a wrapping element to apply padding Edit: Updated all instances of unstyled buttons applying margin by applying an equivalent padding to its parent container element instead.

Screenshot:

Before After
localhost_3000_verify_doc_auth_document_capture(iPhone X) localhost_3000_verify_doc_auth_document_capture(iPhone X) (1)

@aduth aduth requested a review from anniehirshman-gsa April 2, 2021 18:26
@aduth
Copy link
Contributor Author

aduth commented Apr 2, 2021

Track down if there are other instances where we need flexible-width buttons

Method:

  1. Checkout commit prior to merge commit of LG-3865: Remove BassCSS Module: Btn #4836: git checkout c69fc80~1
  2. Project-wide search for BassCSS button classes
    • ag --ignore-dir={node_modules,vendor} "['"]btn "
    • ag --ignore-dir={node_modules,vendor} " f\.button([^%]|\s)+class: '"
  3. Eliminate where classes also contain some width-modifying class (e.g. btn-wide, col-, block)

Candidates:

For most all of these, it's questionable whether the buttons should collapse to a flexible width on mobile. All the same, I'll check each of them.

@aduth
Copy link
Contributor Author

aduth commented Apr 2, 2021

Confirm whether there are other issues with unstyled links applying full-width by default (arguably, unstyled buttons should not ever be applying a width, but this is the default inherited from USWDS).

Confirm whether there are other issues with unstyled links overriding margin and padding conflicting with utility classes.

There were very few btn-link buttons before. Edit: This isn't accurate, since many buttons had been converted prior as of #4825. However, the changes to make unstyled buttons inline here should avoid the issue described in the original description where USWDS unstyled buttons would be block-width.

ag --ignore-dir={node_modules,vendor} "btn-link"

Candidates:

<%= f.button :submit, t('links.resend'), class: 'btn-link ml-tiny' %></p>

<%= f.button :submit, t('links.resend'), class: 'btn-link ml-tiny' %></p>

@aduth aduth force-pushed the aduth-fix-doc-auth-secondary-button branch from ac131ce to 3ea4bfb Compare April 5, 2021 14:16
@aduth aduth marked this pull request as ready for review April 5, 2021 14:28
Not necessary after changing to render unstyled buttons as inline
aduth added 3 commits April 5, 2021 11:00
**Why**: As per purpose of inline styling, should inherit appearance of a link and not occupy 100% width from usa-button base styles
Unstyled buttons are intended to take the appearance of a link. Links don't need those styles
**Why**: Unstyled buttons override margin and take precedent over USWDS margin utility classes. Emulate by adding padding to the container instead
@aduth aduth changed the title Fix buttons intended as flexible width on mobile Fix buttons widths from BassCSS to USWDS migration Apr 5, 2021
Copy link
Contributor

@mitchellhenke mitchellhenke left a comment

Choose a reason for hiding this comment

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

👍🏼 👍🏼 👍🏼

@anniehirshman-gsa
Copy link
Contributor

Thank you SO much for this! Everything looks great 👍

@jmhooper jmhooper merged commit 98fe273 into main Apr 5, 2021
@jmhooper jmhooper deleted the aduth-fix-doc-auth-secondary-button branch April 5, 2021 20:20
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.

4 participants