Skip to content

LG-7242 Accessible Icons#6983

Merged
eric-gade merged 50 commits intomainfrom
eric-lg-7242
Sep 27, 2022
Merged

LG-7242 Accessible Icons#6983
eric-gade merged 50 commits intomainfrom
eric-lg-7242

Conversation

@eric-gade
Copy link
Contributor

What

This PR replaces some of the current iconography with better, more accessible versions. We also update the templates in which these icons are used so that they specify better dimensions for the new designs.

eric-gade added 8 commits September 13, 2022 15:07
Will need to update where it gets used, since this appears to be the
first instance of the icon
-- What
We have replaced half a dozen existing icons with new SVGs. These have
different names in some cases, so the references need to be replaced
in templates. Additionally, these icons require larger display sizes
given their circular shape, so we need to find corresponding template
tags and make sure they are given the correct dimensions (88x88px)

changelog: Internal, Assets, updating icon images and references
changelog: Internal, Assets, updating icon images and references
changelog: Internal, Accessibility, updating icons
@eric-gade eric-gade requested a review from a team September 19, 2022 14:02
changelog: Internal, Accessibility, updating accessible icons
eric-gade added 3 commits September 19, 2022 12:18
changelog: Internal, Accessibility, updating to more accessible icons
changelog: Internal, Accessibility, updating to more accessible icons
changelog: Internal, Accessibility, switching to more accessible icons
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, might be good to add some before/after screenshots to the PR, or maybe some URLs/screens

@@ -2,7 +2,7 @@
position: relative;

&::before {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a duplicate style from the other in _modal.scss. I see both are being applied to the element, it seems like we should only have one.

image

eric-gade added 5 commits September 21, 2022 15:16
Also updating any corresponding templates to use the new
localizations.

changelog: Internal, Accessibility, updating to more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, updating to more accessible icons
@eric-gade
Copy link
Contributor Author

Based on the previous comments by @aduth , and noticing how the modals are implemented throughout the application currently, I have made some slight but wide reaching changes to how icons are displayed.

Recent commits include the following changes:

  • width and height are no longer specified in template markup for icon images. Instead we use the class lg-icon. The idea is that if we need different icon sizes in the future, we can add appropriate classes.
  • The "badge" that displays at the top of a modal is now described in the _icons.scss file, and has been fixed to display correctly and without explicit positioning numbers.
  • I've added the correct alt text and localizations for each of the new icons, and applied those localizations wherever the icons have been used

changelog: Internal, Accessibility, adding more accessible icons
@eric-gade
Copy link
Contributor Author

Some Before and Afters

Could Not Verify ID

BEFORE

Screen Shot 2022-09-21 at 5 19 56 PM

AFTER

Screen Shot 2022-09-21 at 4 47 51 PM

Confirm Personal Key

BEFORE

Screen Shot 2022-09-21 at 5 22 04 PM

AFTER

Screen Shot 2022-09-21 at 4 46 45 PM

Don't Have Your Personal Key?

BEFORE

Screen Shot 2022-09-21 at 5 29 32 PM

AFTER

Screen Shot 2022-09-21 at 5 51 22 PM

Account Deleted

BEFORE

Screen Shot 2022-09-21 at 5 39 42 PM

AFTER

Screen Shot 2022-09-21 at 5 40 50 PM

changelog: Internal, Accessibility, adding more accessible icons
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
eric-gade added 7 commits September 26, 2022 12:15
Also updating the signature of the initialization method

changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
Also updating and corresponding location references.

changelog: Internal, Accessibility, adding more accessible icons
size: '40', alt: t('devise.registrations.start.bullet_6_img'), class: 'margin-top-05 grid-col-auto',
<%= render AlertIconComponent.new(
icon_name: :personal_key,
size: '40', alt: t('devise.registrations.start.bullet_6_img'), class: 'margin-top-05 grid-col-auto'
Copy link
Contributor

@aduth aduth Sep 26, 2022

Choose a reason for hiding this comment

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

Based on the failing build, you'll either need to remove, update, or account for the size attribute here, since it's incompatible with the AlertIconComponent's own default width and height.

Suggested change
size: '40', alt: t('devise.registrations.start.bullet_6_img'), class: 'margin-top-05 grid-col-auto'
width: 40,
height: 40,
alt: t('devise.registrations.start.bullet_6_img'),
class: 'margin-top-05 grid-col-auto',

Or something like this in AlertIconComponent:

def size_attributes
  if tag_options[:size].present?
    { size: tag_options[:size] }
  else
    { width: DEFAULT_WIDTH, height: DEFAULT_HEIGHT }
  end
end

<%= image_tag(
asset_url('p-key.svg'),
size: '40', alt: t('devise.registrations.start.bullet_6_img'), class: 'margin-top-05 grid-col-auto',
<%= render AlertIconComponent.new(
Copy link
Contributor

Choose a reason for hiding this comment

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

On second thought, do we actually want to be updating this icon? It will introduce inconsistency with the rest in the context it's shown (the sign in page when authenticating with an SP at IAL2).

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see now. The p-key.svg that was hanging out at the root level (which I deleted) should have been in get-started with the rest of them. Restoring now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Old screen (now restored)

Screen Shot 2022-09-26 at 3 32 56 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

It's kinda strange to me that the icon for personal key is red when the rest are blue, but I'm assuming it's always been that way, so I think it's something to follow-up with separately.

<% title t('forms.backup_code.confirm_delete') %>

<%= image_tag(asset_url('status/warning.svg'), alt: t('errors.alt.warning'), width: 54, class: 'display-block margin-bottom-4') %>
<%= render AlertIconComponent.new(icon_name: :warning, class: 'display-block margin-bottom-4 alert-icon') %>
Copy link
Contributor

Choose a reason for hiding this comment

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

The 'alert-class' class would be added by the component itself, so I wouldn't expect to see it here.

Suggested change
<%= render AlertIconComponent.new(icon_name: :warning, class: 'display-block margin-bottom-4 alert-icon') %>
<%= render AlertIconComponent.new(icon_name: :warning, class: 'display-block margin-bottom-4') %>

eric-gade added 3 commits September 26, 2022 14:54
changelog: Internal, Accessibility, adding more accessible icons
Also reverting to plain image_tag for the rendering, as with other
sibling icon images in the partial

changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

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

Few more comments, but nothing blocking. LGTM 👍

en:
image_description:
camera_mobile_phone: Camera flashing on a mobile phone
delete: Red trash can
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd have a light preference to have these strings at components.alert_icon to have a clear and consolidated source for component strings. Not a blocker though.

alt={alt}
width={88}
height={88}
className="display-block margin-bottom-4 alert-icon"
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to follow-up to align the componentization of AlertIcon in React to match the corresponding ViewComponent implementation.

eric-gade and others added 5 commits September 26, 2022 16:32
Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
changelog: Internal, Accessibility, adding more accessible icons
We are also adding a couple of tests to ensure that AlertIconComponent
is correctly handling the logic if width, height, and size attributes

changelog: Internal, Accessibility, adding more accessible icons
changelog: Internal, Accessibility, adding more accessible icons
eric-gade added 2 commits September 27, 2022 09:55
changelog: Internal, Accessibility, adding more accessible icons
It's not currently being used, so we are removing any handling of this
option

changelog: Internal, Accessibility, adding more accessible icons
def initialize(status: :error, icon: nil)
if !ICONS.key?(status)
raise ArgumentError, "`status` #{status} is invalid, expected one of #{ICONS.keys}"
if !VALID_STATUS.include?(status)
Copy link
Contributor

Choose a reason for hiding this comment

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

[comment] prefer if with a positive test, or consider unless in a guard clause, e.g. raise ... unless VALID_STATUS.include?(status)

<div id="personal-key-confirm" class="display-none" tabindex='-1'>
<%= render layout: '/shared/modal_layout', locals: { role: 'dialog' } do |label_id, description_id| %>
<div class="padding-y-8 padding-x-2 tablet:padding-x-8 cntnr-skinny bg-white radius-lg key-badge">
<div class="padding-y-8 padding-x-2 tablet:padding-x-8 cntnr-skinny bg-white radius-lg iconic-modal-badge personal-key-badge">
Copy link
Contributor

Choose a reason for hiding this comment

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

is this indentation intentional?

@@ -1,10 +1,10 @@
<% if @webauthn.platform_authenticator %>
<% title t('forms.webauthn_platform_delete.confirm') %>
<% title t('forms.webauthn_platform_delete.confirm') %>
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation here?

<% title t('forms.webauthn_platform_delete.confirm') %>
<% else %>
<% title t('forms.webauthn_delete.confirm') %>
<% title t('forms.webauthn_delete.confirm') %>
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation here?


it 'includes informative image' do
expect(rendered).to have_css("[src*='warning'][alt=#{t('errors.alt.warning')}]")
expect(rendered).to have_css("[src*='warning'][alt='#{t('image_description.warning')}']")
Copy link
Contributor

Choose a reason for hiding this comment

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

[suggestion] consider using a helper, if possible, for this interpolation


it 'includes informative image' do
expect(rendered).to have_css("[src*='error'][alt=#{t('errors.alt.error')}]")
expect(rendered).to have_css("[src*='error'][alt='#{t('image_description.error')}']")
Copy link
Contributor

Choose a reason for hiding this comment

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

[suggestion] consider using a helper, if possible, for this interpolation

Copy link
Contributor

@kbighorse kbighorse left a comment

Choose a reason for hiding this comment

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

Made some non-blocking comments. 👍🏾

@eric-gade eric-gade merged commit 8c3688d into main Sep 27, 2022
@eric-gade eric-gade deleted the eric-lg-7242 branch September 27, 2022 18:21
@solipet solipet mentioned this pull request Sep 29, 2022
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