Skip to content

Replace "btn-border" with USWDS checkbox and radio#5279

Merged
aduth merged 5 commits intomainfrom
aduth-rm-btn-border
Sep 17, 2021
Merged

Replace "btn-border" with USWDS checkbox and radio#5279
aduth merged 5 commits intomainfrom
aduth-rm-btn-border

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Aug 10, 2021

Why:

  • Consistency and alignment toward design system
  • Semantic correctness in considering checkboxes and radio inputs as inputs, not as buttons
  • Eliminates now-unused custom styling and JavaScript
  • Avoids relying on JavaScript for stylistic effects
  • Simpler implementation in some cases

Implementation Notes:

As of identity-style-guide@6 (incorporated in #5265), we now have access to a set of stylized radio and checkbox inputs, including bordered and tile variations, which can serve in place of the custom btn-border class.

Screenshots:

Screen Before After
Sign in Screen Shot 2021-08-10 at 11 04 30 AM Screen Shot 2021-09-08 at 10 47 00 AM
OTP Selection Screen Shot 2021-08-10 at 11 04 18 AM Screen Shot 2021-09-08 at 10 55 51 AM
OTP Setup Screen Shot 2021-08-10 at 11 05 07 AM Screen Shot 2021-09-08 at 10 44 09 AM
Add phone Screen Shot 2021-08-10 at 11 14 54 AM Screen Shot 2021-09-08 at 10 45 02 AM
IAL2 Agreement Screen Shot 2021-08-10 at 11 05 34 AM Screen Shot 2021-09-08 at 10 45 54 AM
IAL2 SSN Toggle Screen Shot 2021-08-10 at 11 05 51 AM Screen Shot 2021-09-08 at 10 46 16 AM

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT of adding a newline?

Suggested change
<label class="usa-radio__label"><%= t('two_factor_authentication.otp_delivery_preference.voice') %>
<label class="usa-radio__label">
<%= t('two_factor_authentication.otp_delivery_preference.voice') %>

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 one of the rare, unfortunate cases where whitespace matters in HTML. The newline collapses down to a single space, which throws off the layout.

I'd definitely agree it would hopefully be something we shouldn't need to worry about. I'm thinking about a few ways we could address this:

  • Try to control whitespace behavior with CSS styling
  • Use utilities like label_tag, etc. and avoid writing out the markup

Copy link
Contributor

Choose a reason for hiding this comment

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

I think CSS styling would be ideal, or maybe we go with a comment approach

Suggested change
<label class="usa-radio__label"><%= t('two_factor_authentication.otp_delivery_preference.voice') %>
<label class="usa-radio__label"><!-- can't have leading whitespace
--><%= t('two_factor_authentication.otp_delivery_preference.voice') %>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Follow-up at uswds/uswds#4286. Still on the fence for how to handle it in the short-term.

Copy link
Contributor

Choose a reason for hiding this comment

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

@anniehirshman-gsa Good question. I would be fine with updating this in the design system. Might be worth a check with Chanan if it'd have any impact on her work on the upcoming partners site.

@aduth confirming that the larger text size (1.125 rem) is approved on the UX side for tiled radio buttons and checkboxes, and I've updated Figma. Figma also reflects the larger padding that would be great to update as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @anniehirshman-gsa . I've got a small conundrum to sort out with the whitespace improvements from this thread, but otherwise my plan will be to incorporate those changes as a temporary patch into the design system. I can make the tile font size changes around the same time. Since all this is non-ticketed refactoring, I might be a bit delayed in getting to it for prioritization's sake.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we want to merge this sooner rather than later, I think it might be nice to leave the commented version of the newline, and then we could leave in a "fix after USDWS update" in there too so we can find them easily if/when USWDS is handled to be more tolerant of whitespace

Copy link
Contributor

Choose a reason for hiding this comment

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

did one of the linters move the text up?

Copy link
Contributor

Choose a reason for hiding this comment

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

is the for here needed for CSS or is it just for accessibility best practices?

Copy link
Contributor Author

@aduth aduth Aug 11, 2021

Choose a reason for hiding this comment

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

is the for here needed for CSS or is it just for accessibility best practices?

It's needed both for accessibility and also to maintain the behavior that clicking the label should toggle the checkbox.

Previously we were relying on implicit label association by using the label to wrap both the input and label text. That's not an option for the design system checkboxes.

Copy link
Contributor

@anniehirshman-gsa anniehirshman-gsa left a comment

Choose a reason for hiding this comment

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

Screenshots and checkboxes are looking good!

For the tiled radio groups: the IdP uses a slightly larger size for the blue text/label that I'd like to retain for emphasis, even though I know it's not in the design system right now. (I used 1.125 rem aka h3 size in the Public Sans update.) Any suggestions on the best way to implement that? Also looping in @nickttng for opinions if you have

@aduth
Copy link
Contributor Author

aduth commented Aug 11, 2021

For the tiled radio groups: the IdP uses a slightly larger size for the blue text/label that I'd like to retain for emphasis, even though I know it's not in the design system right now. (I used 1.125 rem aka h3 size in the Public Sans update.) Any suggestions on the best way to implement that?

Should it be IdP-specific, or would it make sense to update it in the design system?

@anniehirshman-gsa
Copy link
Contributor

For the tiled radio groups: the IdP uses a slightly larger size for the blue text/label that I'd like to retain for emphasis, even though I know it's not in the design system right now. (I used 1.125 rem aka h3 size in the Public Sans update.) Any suggestions on the best way to implement that?

Should it be IdP-specific, or would it make sense to update it in the design system?

All of the examples I know of in the IdP have the larger text size, so I would be fine with updating this in the design system. @nickttng do you think we should go ahead and make this change in the design system, keep it IdP-specific, throw it out to the wider group for discussion?

@nickttng
Copy link
Contributor

@anniehirshman-gsa Good question. I would be fine with updating this in the design system. Might be worth a check with Chanan if it'd have any impact on her work on the upcoming partners site.

@aduth aduth changed the title Replace "btn-border" with USWDS checkbox Replace "btn-border" with USWDS checkbox and radio Aug 13, 2021
@aduth aduth force-pushed the aduth-rm-btn-border branch from e519dc7 to 7bb7c7b Compare September 8, 2021 14:49
@aduth
Copy link
Contributor Author

aduth commented Sep 8, 2021

I rebased the branch to resolve conflicts and updated screenshots in the original comment to reflect pending changes from upcoming identity-style-guide@6.1.0.

A couple things to complete before this is ready:

aduth added a commit that referenced this pull request Sep 8, 2021
**Why**: Because it's unused and is an ongoing maintenance burden (e.g. #5279).
aduth added a commit that referenced this pull request Sep 9, 2021
* Remove unused service_provider_mfa/new.html.erb

**Why**: Because it's unused and is an ongoing maintenance burden (e.g. #5279).

* Remove empty directory from ERBLint exclude
@aduth aduth force-pushed the aduth-rm-btn-border branch from a865f70 to 4675a19 Compare September 13, 2021 13:38
Copy link
Contributor

@anniehirshman-gsa anniehirshman-gsa left a comment

Choose a reason for hiding this comment

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

LGTM!

aduth and others added 4 commits September 17, 2021 10:56
**Why**:

- Consistency and alignment toward design system
- Semantic correctness in considering checkboxes and radio inputs as inputs, not as buttons
- Eliminates now-unused custom styling and JavaScript
- Avoids relying on JavaScript for stylistic effects
- Simpler implementation in some cases
Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
Avoid offset layout
@aduth aduth force-pushed the aduth-rm-btn-border branch from 47a51d6 to c6c7e7e Compare September 17, 2021 15:08
@aduth aduth merged commit 5ea33a2 into main Sep 17, 2021
@aduth aduth deleted the aduth-rm-btn-border branch September 17, 2021 16:34
mitchellhenke pushed a commit that referenced this pull request Sep 22, 2021
* Replace "btn-border" with USWDS checkbox

**Why**:

- Consistency and alignment toward design system
- Semantic correctness in considering checkboxes and radio inputs as inputs, not as buttons
- Eliminates now-unused custom styling and JavaScript
- Avoids relying on JavaScript for stylistic effects
- Simpler implementation in some cases

* Use constant for Privacy URL

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>

* Omit empty label

Avoid offset layout

* Simplify radio disabled logic

* Replace border-none with border-0

Rebase error

Co-authored-by: Zach Margolis <zachmargolis@users.noreply.github.com>
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