Skip to content
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
4 changes: 2 additions & 2 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ linters:
- 'order-([0-3]|last)'
- 'not-rounded'
- 'rounded-(top|right|bottom|left)'
- '(md|lg)-hide'
- '(xs|md|lg)-show'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Re: Removing xs here: I may have been confused in the original technical discovery, since BassCSS at some point in time had xs- prefixes:

https://github.com/basscss/basscss/blob/8104041/modules/hide/index.css#L12

But these do not exist in the NPM module version we're using:

https://github.com/basscss/basscss-sass/blob/v3.0.0/_responsive-states.scss#L66-L105

- '((sm|md|lg)-)?hide'
- '(sm|md|lg)-show'
- 'btn-(small|big|narrow|transparent)'
- 'border-(black|gray|white|aqua|orange|fuchsia|purple|maroon|darken-[1-4]|lighten-[1-4])'
suggestion: 'Use USWDS classes instead of BassCSS.'
1 change: 0 additions & 1 deletion app/assets/stylesheets/_vendor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@import 'basscss-sass/utility-layout';
@import 'basscss-sass/white-space';
@import 'basscss-sass/positions';
@import 'basscss-sass/responsive-states';
@import 'basscss-sass/grid';
@import 'basscss-sass/flex-object';
@import 'basscss-sass/borders';
Expand Down
1 change: 0 additions & 1 deletion app/assets/stylesheets/components/_btn.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
border-style: solid;
border-width: $border-width;
box-sizing: border-box;
display: inline-block;
padding: $space-1 $space-2;

&.is-focused {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/packs/pw-strength.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function analyzePw() {

disableSubmit(submit);

// the pw strength module is hidden by default ("hide" CSS class)
// the pw strength module is hidden by default ("display-none" CSS class)
// (so that javascript disabled browsers won't see it)
// thus, first step is unhiding it
pwCntnr.className = '';
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/packs/saml-post.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.addEventListener('DOMContentLoaded', function () {
document.body.className += ' hide';
document.body.className += ' usa-sr-only';
document.getElementById('saml-post-binding').submit();
});
4 changes: 2 additions & 2 deletions app/javascript/packs/webauthn-unhide-signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ function unhideWebauthn() {
if (WebAuthn.isWebAuthnEnabled()) {
const elem = document.getElementById('select_webauthn');
if (elem) {
elem.classList.remove('hide');
elem.classList.remove('display-none');
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 for alternative options for "Choose another authentication method", to present Security Key as an option only if the browser supports it.

Suggesting to keep this as display: none, since it's intended not to be available as an option by default.

}
} else {
const checkboxes = document.querySelectorAll(
'input[name="two_factor_options_form[selection]"]',
);
for (let i = 0, len = checkboxes.length; i < len; i += 1) {
if (!checkboxes[i].classList.contains('hide')) {
if (!checkboxes[i].classList.contains('display-none')) {
checkboxes[i].checked = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/packs/webauthn-unhide-signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function unhideWebauthn() {
const elem = document.querySelector('label[for=two_factor_options_form_selection_webauthn]');
if (elem) {
elem.hidden = false;
elem.classList.remove('hide');
elem.classList.remove('display-none');
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 for 2FA options for signup, to present Security Key as an option only if the browser supports it.

Suggesting to keep this as display: none, since it's intended not to be available as an option by default.

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def method
end

def html_class
'hide'
'display-none'
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 corresponds to above note about 2FA options for signup, and must match the JavaScript logic for showing the option if the browser supports WebAuthn, by removing the class of the same name.

This is also how I discovered the issue described in #4638 (comment), where a screen-reader-only class could interoperate with .btn-border's own display: inline-block, but display-none would not.

end

# :reek:UtilityFunction
Expand Down
2 changes: 1 addition & 1 deletion app/views/account_reset/request/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
t('users.personal_key.print'),
'#',
data: { print: true },
class: 'ml2 btn-border ico ico-print text-decoration-none',
class: 'ml2 btn-border display-inline-block ico ico-print text-decoration-none',
) %>
</div>
<hr/>
Expand Down
6 changes: 3 additions & 3 deletions app/views/accounts/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<div class="clearfix pt2 pb3 sm-py0 mb3 bg-lightest-blue sm-bg-none">
<div class="sm-col sm-col-4">
<h1 class="h3 m0 center sm-left-align">
<span class="regular sans-serif sm-hide">
<span class="regular sans-serif tablet:display-none">
<%= t('account.welcome') %>,
<span class="bold">
<%= view_model.header_personalization %>
</span>
</span>
<span class="sm-show">
<span class="display-none tablet:display-inline">
<%= t('headings.account.login_info') %>
</span>
</h1>
</div>
<%= render 'accounts/badges' %>
</div>
<div class="px2 pb1 bold h3 sm-hide serif">
<div class="px2 pb1 bold h3 tablet:display-none serif">
<%= t('headings.account.login_info') %>
</div>
2 changes: 1 addition & 1 deletion app/views/accounts/actions/_delete_account.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= link_to account_delete_path do %>
<span class='hide'>
<span class='usa-sr-only'>
<%= t('account.items.delete_your_account') %>
</span>
<%= t('account.links.delete_account') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/actions/_edit_action_button.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= link_to path do %>
<span class='hide'>
<span class='usa-sr-only'>
<%= name %>
</span>
<%= t('forms.buttons.edit') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/actions/_enable_piv_cac.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= link_to setup_piv_cac_url, class: 'btn btn-account-action rounded-lg bg-light-blue add-piv' do %>
<span class="hide">
<span class="usa-sr-only">
<%= t('account.index.piv_cac_card') %>
</span>
<%= prefix_with_plus(t('forms.buttons.enable')) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/actions/_manage_action_button.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= link_to path do %>
<span class='hide'>
<span class='usa-sr-only'>
<%= name %>
</span>
<%= t('forms.buttons.manage') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/actions/_manage_personal_key.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
class: 'btn btn-link ml1',
form_class: 'inline-block',
) do %>
<span class='hide'>
<span class='usa-sr-only'>
<%= t('account.items.personal_key') %>
</span>
<%= t('account.links.regenerate_personal_key') %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/shared/_password_strength.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id='pw-strength-cntnr' class='hide' aria-live='polite' aria-atomic='true'>
<div id='pw-strength-cntnr' class='display-none' aria-live='polite' aria-atomic='true'>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As described in a JavaScript comment, the purpose of the class is to hide the strength meter from JavaScript-disabled browsers.

Suggesting to keep this as display: none.

<div class='mtn3 mb3'>
<div class='clearfix mxn-tiny pt-tiny'>
<div class='pw-bar'></div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/idv/in_person/usps_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
FORT MYER, VA 22211-9998 </div>
</div>
</label>
<label class="btn-border col-12 mb2 hide" for="two_factor_options_form_selection_webauthn">
<label class="btn-border col-12 mb2 display-none" for="two_factor_options_form_selection_webauthn">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not clear to me why we hide this, but given that the content of the page appears to be static text content for a work-in-progress flow presumably copied from 2FA options page markup, I'm not too concerned about it.

<div class="radio">
<input type="radio" name="two_factor_options_form[selection]" id="two_factor_options_form_selection_webauthn" value="webauthn" />
<span class="indicator mt-tiny"></span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/service_provider_mfa/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<% @presenter.options.each do |option| %>
<%= label_tag "two_factor_options_form_selection_#{option.type}",
class: "btn-border col-12 mb2 #{option.html_class}",
hidden: option.html_class == 'hide' do %>
hidden: option.html_class == 'display-none' do %>
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 should correspond to WebauthnSelectionPresenter#html_class, which it does.

<div class="radio">
<%= radio_button_tag('two_factor_options_form[selection]', option.type) %>
<span class="indicator mt-tiny"></span>
Expand Down
47 changes: 20 additions & 27 deletions app/views/shared/_footer_lite.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<footer class='footer bg-light-blue sm-bg-navy'>
<% if show_language_dropdown %>
<div class='sm-hide border-bottom'>
<div class='tablet:display-none border-bottom'>
<div class='container cntnr-wide py1 px2 lg-px0 h5'>
<div class='i18n-mobile-toggle center'>
<%= link_to('#', class: 'block text-decoration-none blue fs-13p', 'aria-expanded': 'false') do %>
Expand All @@ -15,7 +15,7 @@
</div>
</div>
</div>
<div class='i18n-mobile-dropdown sm-hide display-none'>
<div class='i18n-mobile-dropdown tablet:display-none display-none'>
<ul class='list-reset mb0 white center'>
<% I18n.available_locales.each do |locale| %>
<li class='border-bottom'>
Expand All @@ -28,15 +28,15 @@
<div class='container py1 px2 lg-px0 <%= 'sm-py0' if show_language_dropdown %>'>
<div class='flex flex-center'>
<div class='flex flex-auto flex-first'>
<div class="sm-hide">
<%= new_window_link_to 'https://gsa.gov', { class: 'flex flex-center text-decoration-none white h6 mr1 sm-hide',
<div class="tablet:display-none">
<%= new_window_link_to 'https://gsa.gov', { class: 'flex flex-center text-decoration-none white h6 mr1 tablet:display-none',
'aria-label': t('shared.footer_lite.gsa') } do %>
<%= image_tag asset_url('sp-logos/square-gsa-dark.svg'),
width: 20, alt: '' %>
<% end %>
</div>

<div class="sm-show">
<div class="display-none tablet:display-block">
<%= new_window_link_to 'https://gsa.gov', { class: 'flex flex-center text-decoration-none white h6 mr1 usa-link--alt',
'aria-label': t('shared.footer_lite.gsa') } do %>
<%= image_tag asset_url('sp-logos/square-gsa.svg'),
Expand All @@ -49,7 +49,7 @@
</div>
<div class='flex flex-center'>
<% if show_language_dropdown %>
<ul class='list-reset sm-show mb0'>
<ul class='list-reset display-none tablet:display-block mb0'>
<li class='i18n-desktop-toggle flex my1 mx2 relative'>
<%= link_to '#', class: 'white text-decoration-none border border-blue rounded-lg px1 py-tiny', 'aria-expanded': 'false' do %>
<%= image_tag asset_url('globe-white.svg'), width: 12, class: 'mr1', alt: '',
Expand All @@ -70,29 +70,22 @@
</ul>
<% end %>

<div class="sm-hide">
<div class="display-flex">
<%= new_window_link_to(t('links.help'), MarketingSite.help_url,
class: 'caps h6 blue text-decoration-none mr2') %>
<%= new_window_link_to(t('links.contact'), MarketingSite.contact_url,
class: 'caps h6 blue text-decoration-none mr2') %>
<%= new_window_link_to(t('links.privacy_policy'), MarketingSite.security_and_privacy_practices_url,
class: 'caps h6 blue text-decoration-none mr2') %>
</div>
<div class="display-flex tablet:display-none">
<%= new_window_link_to(t('links.help'), MarketingSite.help_url,
class: 'caps h6 blue text-decoration-none mr2') %>
<%= new_window_link_to(t('links.contact'), MarketingSite.contact_url,
class: 'caps h6 blue text-decoration-none mr2') %>
<%= new_window_link_to(t('links.privacy_policy'), MarketingSite.security_and_privacy_practices_url,
class: 'caps h6 blue text-decoration-none mr2') %>
</div>

<div class="sm-show">
<%# Note: Once BassCSS is removed, absorb this wrapper into the parent and use class
`display-none tablet:display-flex`. This is not currently possible because BassCSS's
`display-none` applies using `!important`. %>
<div class="display-flex">
<%= new_window_link_to(t('links.help'), MarketingSite.help_url,
class: 'caps h6 white text-decoration-none mr2 usa-link--alt') %>
<%= new_window_link_to(t('links.contact'), MarketingSite.contact_url,
class: 'caps h6 white text-decoration-none mr2 usa-link--alt') %>
<%= new_window_link_to(t('links.privacy_policy'), MarketingSite.security_and_privacy_practices_url,
class: 'caps h6 white text-decoration-none mr2 usa-link--alt') %>
</div>
<div class="display-none tablet:display-flex">
<%= new_window_link_to(t('links.help'), MarketingSite.help_url,
class: 'caps h6 white text-decoration-none mr2 usa-link--alt') %>
<%= new_window_link_to(t('links.contact'), MarketingSite.contact_url,
class: 'caps h6 white text-decoration-none mr2 usa-link--alt') %>
<%= new_window_link_to(t('links.privacy_policy'), MarketingSite.security_and_privacy_practices_url,
class: 'caps h6 white text-decoration-none mr2 usa-link--alt') %>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/shared/_personal_key_confirmation_modal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>

<div class="clearfix mxn2">
<div class="col col-12 sm-col-6 px2 mb2 sm-mb0 sm-hide">
<div class="col col-12 sm-col-6 px2 mb2 sm-mb0 tablet:display-none">
<button type="submit" class="col-12 btn btn-primary personal-key-confirm">
<%= t('forms.buttons.continue') %>
</button>
Expand All @@ -30,7 +30,7 @@
<%= t('forms.buttons.back') %>
</button>
</div>
<div class="col col-12 sm-col-6 px2 mb2 sm-mb0 sm-show">
<div class="col col-12 sm-col-6 px2 mb2 sm-mb0 display-none tablet:display-block">
<button type="submit" class="col-12 btn btn-primary personal-key-confirm">
<%= t('forms.buttons.continue') %>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<% @presenter.options.each do |option| %>
<%= label_tag "two_factor_options_form_selection_#{option.type}",
class: "btn-border col-12 mb2 #{option.html_class}",
hidden: option.html_class == 'hide' do %>
hidden: option.html_class == 'display-none' do %>
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 should correspond to WebauthnSelectionPresenter#html_class, which it does.

<div class="radio">
<%= radio_button_tag('two_factor_options_form[selection]', option.type) %>
<span class="indicator mt-tiny"></span>
Expand Down
2 changes: 1 addition & 1 deletion spec/features/users/user_profile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
sign_in_and_2fa_user
click_link 'Edit', href: manage_password_path

expect(page).to_not have_css('#pw-strength-cntnr.hide')
expect(page).to_not have_css('#pw-strength-cntnr.display-none')
expect(page).to have_content '...'

fill_in 'update_user_password_form_password', with: 'this is a great sentence'
Expand Down
6 changes: 3 additions & 3 deletions spec/features/visitors/set_password_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
create(:user, :unconfirmed)
confirm_last_user

expect(page).to have_css('#pw-strength-cntnr.hide')
expect(page).to have_css('#pw-strength-cntnr.display-none')
end

context 'password strength indicator when JS is on', js: true do
Expand All @@ -37,8 +37,8 @@
confirm_last_user
end

it 'is visible on page (not have "hide" class)' do
expect(page).to_not have_css('#pw-strength-cntnr.hide')
it 'is visible on page (not have "display-none" class)' do
expect(page).to_not have_css('#pw-strength-cntnr.display-none')
end

it 'updates as password changes' do
Expand Down
4 changes: 2 additions & 2 deletions spec/features/webauthn/hidden_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def webauthn_option_hidden?
page.find(
'label[for=two_factor_options_form_selection_webauthn]',
visible: :all,
)[:class].include?('hide')
)[:class].include?('display-none')
end
end

Expand Down Expand Up @@ -50,7 +50,7 @@ def webauthn_option_hidden?
def webauthn_option_hidden?
page.find(
'label[for=two_factor_options_form_selection_webauthn]',
).find(:xpath, '..')[:class].include?('hide')
).find(:xpath, '..')[:class].include?('display-none')
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
end

describe '#html_class' do
it 'returns hide' do
expect(subject.html_class).to eq 'hide'
it 'returns display-none' do
expect(subject.html_class).to eq 'display-none'
end
end
end