Skip to content

LG-7949: Change behavior of "skip to content link" on account page#7310

Merged
jc-gsa merged 5 commits intomainfrom
LG-7949-skip-to-content
Nov 9, 2022
Merged

LG-7949: Change behavior of "skip to content link" on account page#7310
jc-gsa merged 5 commits intomainfrom
LG-7949-skip-to-content

Conversation

@jc-gsa
Copy link
Contributor

@jc-gsa jc-gsa commented Nov 7, 2022

🎫 Ticket

LG-7949

🛠 Summary of changes

This PR changes the behavior of the accessibility link Skip to main content on the page /account.

The layout found at app/views/layouts/account_side_nav.html.erb overrides portions of the base layout. On the account page, the location of the tag main is changed so that the accessibility link Skip to main content jumps to the desired location.

Suggestions and improvements to these two conflicting layouts are welcome.

@jc-gsa jc-gsa requested a review from a team November 7, 2022 22:23
changelog: Improvements, Accessibility, Improve accessibility link (LG-7949)
@jc-gsa jc-gsa force-pushed the LG-7949-skip-to-content branch from d6a77b3 to 3fb5bc8 Compare November 7, 2022 23:07

<% if IdentityConfig.store.newrelic_browser_key.present? && IdentityConfig.store.newrelic_browser_app_id.present? %>
<%= render 'shared/newrelic/browser_instrumentation' %>
<%= render 'shared/newrelic/browser_instrumentation' %>
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️ thanks for fixing this indentation while we're here!

Comment on lines +61 to +67
<%= content_tag(local_assigns[:custom_main].present? ? 'div' : 'main', { class: 'site-wrap bg-primary-lighter', id: local_assigns[:custom_main].present? ? 'main-wrapper' : 'main-content' }) do %>
<div class="grid-container padding-y-4 tablet:padding-y-8 <%= local_assigns[:disable_card].present? ? '' : 'card' %>">
<%= yield(:pre_flash_content) if content_for?(:pre_flash_content) %>
<%= render FlashComponent.new(flash: flash) %>
<%= content_for?(:content) ? yield(:content) : yield %>
</div>
<% end %>
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this has an indent by 4 instead of by 2? also maybe let's put the content_tag stuff on separate lines so it's easier to follow?

Suggested change
<%= content_tag(local_assigns[:custom_main].present? ? 'div' : 'main', { class: 'site-wrap bg-primary-lighter', id: local_assigns[:custom_main].present? ? 'main-wrapper' : 'main-content' }) do %>
<div class="grid-container padding-y-4 tablet:padding-y-8 <%= local_assigns[:disable_card].present? ? '' : 'card' %>">
<%= yield(:pre_flash_content) if content_for?(:pre_flash_content) %>
<%= render FlashComponent.new(flash: flash) %>
<%= content_for?(:content) ? yield(:content) : yield %>
</div>
<% end %>
<%= content_tag(
local_assigns[:custom_main].present? ? 'div' : 'main',
class: 'site-wrap bg-primary-lighter',
id: local_assigns[:custom_main].present? ? 'main-wrapper' : 'main-content'
) do %>
<div class="grid-container padding-y-4 tablet:padding-y-8 <%= local_assigns[:disable_card].present? ? '' : 'card' %>">
<%= yield(:pre_flash_content) if content_for?(:pre_flash_content) %>
<%= render FlashComponent.new(flash: flash) %>
<%= content_for?(:content) ? yield(:content) : yield %>
</div>
<% end %>


<%= javascript_packs_tag_once('navigation') %>
<%= render template: 'layouts/base', locals: { disable_card: true } %>
<%= render template: 'layouts/base', locals: { disable_card: true, custom_main: true } %>
Copy link
Contributor

Choose a reason for hiding this comment

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

what if we named the argument use_main to indicate that the template should not have a <main> tag? (and flip the corresponding logic)

Suggested change
<%= render template: 'layouts/base', locals: { disable_card: true, custom_main: true } %>
<%= render template: 'layouts/base', locals: { disable_card: true, use_main: false } %>

Copy link
Contributor

Choose a reason for hiding this comment

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

another idea: user_main_tag: false ?

Copy link
Contributor Author

@jc-gsa jc-gsa Nov 7, 2022

Choose a reason for hiding this comment

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

I've just realized a different approach or more changes are necessary, as the rule https://dequeuniversity.com/rules/axe/4.3/region?application=axeAPI is violated.

A simple change would be to change how the line <%= link_to t('shared.skip_link'), '#main-content', class: 'usa-skipnav' %> works in the base layout. The id of #main-content could be changed by the layout file identity-idp/app/views/layouts/account_side_nav.html.erb.

Otherwise a bigger restructure of the layouts and accounts page seems to be necessary. The partial identity-idp/app/views/accounts/_side_nav.html.erb functions as a second nav. But this partial is nested [edit] outside of landmark tags in the current change.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the accessibility build failure, it looks like the only content which is not within a landmark is the top "Access your government benefits ..." content. It seems like it would be appropriate to mark this up as an <aside>, since it's content which complements the main content?

i.e. changing this element from <div> to <aside>:

<div class="display-none tablet:display-flex grid-row grid-gap margin-bottom-4">

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zachmargolis I have made your suggested changes. But I find the name user_main_tag: false to be confusing, and I find the boolean check for false more difficult to read.

</div>
</main>

<%= content_tag(local_assigns[:custom_main].present? ? 'div' : 'main', { class: 'site-wrap bg-primary-lighter', id: local_assigns[:custom_main].present? ? 'main-wrapper' : 'main-content' }) do %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're not using the main-wrapper ID for anything, could we avoid assigning the id for the custom main case?

Suggested change
<%= content_tag(local_assigns[:custom_main].present? ? 'div' : 'main', { class: 'site-wrap bg-primary-lighter', id: local_assigns[:custom_main].present? ? 'main-wrapper' : 'main-content' }) do %>
<%= content_tag(local_assigns[:custom_main] ? 'div' : 'main', { class: 'site-wrap bg-primary-lighter', id: local_assigns[:custom_main] ? nil : 'main-content' }) do %>

@jmdembe
Copy link
Contributor

jmdembe commented Nov 8, 2022

As it stands, the skip link is only going to the main account content. We need to have it so that the user has the option to either skip to the main navigation, or the account preferences

@aduth
Copy link
Contributor

aduth commented Nov 8, 2022

As it stands, the skip link is only going to the main account content. We need to have it so that the user has the option to either skip to the main navigation, or the account preferences

My understanding is that the ticket being addressed here is to resolve a bug with how "Skip to main content" operates, which currently does not work as expected, as it should bypass the repeated navigation elements. We could explore additional skip links, but this seems like a separate task, and may require more exploration to whether it helps more than it hurts.

@jmdembe
Copy link
Contributor

jmdembe commented Nov 8, 2022

As it stands, the skip link is only going to the main account content. We need to have it so that the user has the option to either skip to the main navigation, or the account preferences

My understanding is that the ticket being addressed here is to resolve a bug with how "Skip to main content" operates, which currently does not work as expected, as it should bypass the repeated navigation elements. We could explore additional skip links, but this seems like a separate task, and may require more exploration to whether it helps more than it hurts.

I can see the help/hurt concern. I am thinking of a case where someone would want to navigate to that menu and the only way to get to it at this point is to back tab through the first element, which is not a good experience.

I would feel okay with this fix as it stands, but I would like a further discussion with IRS/other accessibility folks on the team to assess if my concern is valid.

@jc-gsa
Copy link
Contributor Author

jc-gsa commented Nov 8, 2022

@jmdembe I raised your concerns when I started the ticket and again in the group meeting. As I understand it, others want the accessibility link to point to the "right hand side" of the main screen. If these changes are not desired, then the PR can be dropped.

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.

This LGTM as addressing the bug described in the ticket 👍

Separately, it seems like it'd be good to sync as a team on whether there's any action regarding navigating to page elements other than the main content. Can we discuss after standup tomorrow?

@jmdembe
Copy link
Contributor

jmdembe commented Nov 8, 2022

@jmdembe I raised your concerns when I started the ticket and again in the group meeting. As I understand it, others want the accessibility link to point to the "right hand side" of the main screen. If these changes are not desired, then the PR can be dropped.

I am going to seek further clarification so that everyone is on the same page

@jc-gsa jc-gsa merged commit 58ef8e2 into main Nov 9, 2022
@jc-gsa jc-gsa deleted the LG-7949-skip-to-content branch November 9, 2022 22:20
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