From a673913ab503f02cdb77d20dc426ee59258f7831 Mon Sep 17 00:00:00 2001 From: Brian Hurst Date: Thu, 26 Jan 2017 10:03:09 -0500 Subject: [PATCH] Add screen reader text to profile page **Why**: To provide additional context for edit links --- app/views/profile/index.html.slim | 27 ++++++++++++++-------- spec/views/profile/index.html.slim_spec.rb | 4 ++-- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/app/views/profile/index.html.slim b/app/views/profile/index.html.slim index 5178465adfb..413f4a79c6d 100644 --- a/app/views/profile/index.html.slim +++ b/app/views/profile/index.html.slim @@ -53,12 +53,16 @@ h2.h3.my0 .sm-col.sm-col-5.px1 = t('.email') .sm-col.sm-col-5.px1.truncate = current_user.email .sm-col.sm-col-2.px1.sm-right-align - = link_to t('forms.buttons.edit'), manage_email_path, class: btn_cls + = link_to manage_email_path, class: btn_cls do + span.hide = t('.email') + = t('forms.buttons.edit') .py-12p.border-top.border-bottom .clearfix.mxn1 .sm-col.sm-col-10.px1 = t('.password') .sm-col.sm-col-2.px1.sm-right-align - = link_to t('forms.buttons.edit'), manage_password_path, class: btn_cls + = link_to manage_password_path, class: btn_cls do + span.hide = t('.password') + = t('forms.buttons.edit') .mt3.mb1.h6.bold.caps.ls-0 | #{t('headings.profile.two_factor')}#{tooltip(t('tooltips.two_factor'))} .py-12p.border-top @@ -66,23 +70,28 @@ h2.h3.my0 .sm-col.sm-col-5.px1 = t('.phone') .sm-col.sm-col-5.px1 = current_user.phone .sm-col.sm-col-2.px1.sm-right-align - = link_to t('forms.buttons.edit'), manage_phone_path, class: btn_cls + = link_to manage_phone_path, class: btn_cls do + span.hide = t('.phone') + = t('forms.buttons.edit') .py-12p.border-top .clearfix.mxn1 .sm-col.sm-col-10.px1 = t('.authentication_app') .sm-col.sm-col-2.px1.sm-right-align - if current_user.totp_enabled? - = button_to t('forms.buttons.disable'), disable_totp_url, \ - method: :delete, class: btn_cls + = button_to disable_totp_url, method: :delete, class: btn_cls do + span.hide = t('.authentication_app') + = t('forms.buttons.disable') - else - = link_to t('forms.buttons.enable'), authenticator_start_url, \ - class: btn_cls + = link_to authenticator_start_url, class: btn_cls do + span.hide = t('.authentication_app') + = t('forms.buttons.enable') .py-12p.border-top.border-bottom .clearfix.mxn1 .sm-col.sm-col-10.px1 = t('profile.items.recovery_code') .sm-col.sm-col-2.px1.sm-right-align - = link_to t('profile.links.regenerate_recovery_code'), \ - manage_recovery_code_path, class: btn_cls + = link_to manage_recovery_code_path, class: btn_cls do + span.hide = t('profile.items.recovery_code') + = t('profile.links.regenerate_recovery_code') h2.h3.my0 = t('headings.profile.account_history') .mt2.mb2 diff --git a/spec/views/profile/index.html.slim_spec.rb b/spec/views/profile/index.html.slim_spec.rb index 9975b660c3d..3ce2da92142 100644 --- a/spec/views/profile/index.html.slim_spec.rb +++ b/spec/views/profile/index.html.slim_spec.rb @@ -37,8 +37,8 @@ render - expect(rendered).to have_xpath("//input[@value='Disable']") - expect(rendered).not_to have_link('Enable', href: authenticator_start_path) + expect(rendered).to have_button t('forms.buttons.disable') + expect(rendered).not_to have_link(t('forms.buttons.enable'), href: authenticator_start_path) end end