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

Badge: Improve visual appearance and accessibility, simplify markup #251

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### Improvements

- Navbar link text is no longer uppercase.
- Visual alignment of Badge component is improved, and its markup guidance has been simplified with improved accessibility semantics.

## 6.1.0

Expand Down
8 changes: 4 additions & 4 deletions docs/_components/badges.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ The unphishable badge is used to indicate that an account is only using security

{% capture example %}
<div class="lg-verification-badge">
<img src="{{ site.baseurl }}/assets/img/alerts/unphishable.svg" role="img" width="16" height="16" class="text-middle" alt="unphishable icon" id="unphishable_badge" />
<span>Unphishable</span>
<img src="{{ site.baseurl }}/assets/img/alerts/unphishable.svg" role="img" width="16" height="16" alt="" />
Unphishable
</div>
{% endcapture %}
{% include helpers/code-example.html code=example %}
Expand All @@ -26,8 +26,8 @@ A verfied account badge is used to indicate that an account has completed the id

{% capture example %}
<div class="lg-verification-badge">
<img src="{{ site.baseurl }}/assets/img/alerts/success-badge.svg" role="img" width="16" height="16" class="text-middle" alt="verification icon" id="verified_account_badge" />
<span>Verified Account</span>
<img src="{{ site.baseurl }}/assets/img/alerts/success-badge.svg" role="img" width="16" height="16" alt="" />
Verified Account
</div>
{% endcapture %}
{% include helpers/code-example.html code=example %}
15 changes: 2 additions & 13 deletions src/scss/components/_verification-badge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,12 @@
background-color: map-get($site-palette, 'site-white');
border: units(1px) solid map-get($site-palette, 'site-green');
box-sizing: border-box;
display: inline-block;
display: inline-flex;
align-items: center;
padding: units(1) units(2);
white-space: nowrap;

img {
margin-right: units(1);
}

span {
vertical-align: text-top;
}
}

@media #{$theme-site-margins-breakpoint} {
Copy link
Member Author

Choose a reason for hiding this comment

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

$theme-site-margins-breakpoint comes from USWDS and is equal to the string value "desktop" (source). @media desktop { is not a valid media query. This would have needed to use the at-media mixin to do anything. Based on the styles, I'm assuming this is meant to address some of the IdP-specific styling of verification badges as right-aligned on the account page at desktop viewports. Since it's project-specific, I don't think it's appropriate to keep.

.lg-verification-badge {
margin: units(-1) 0 0;
position: static;
text-align: right;
}
}