Skip to content
This repository has been archived by the owner on Jun 26, 2018. It is now read-only.

DP-1795 a11y Alert Elements changes #358

Merged
merged 4 commits into from
Mar 9, 2017
Merged

DP-1795 a11y Alert Elements changes #358

merged 4 commits into from
Mar 9, 2017

Conversation

ygannett
Copy link
Contributor

@ygannett ygannett commented Mar 6, 2017

DP-1854

Note: Please inquire of @mrossi113 this item. Her change is in my PR because it happened to be in the template I'd been working on.

Add tabindex="0" to .ma__emergency-alert container.

DP-1874

Add semantics to the alert section.

Alert Heading

<div class="ma__emergency-header"> is replaced with <h2> to accommodate the alert type addressed in .ma__emergency-header__label as a part of the header.

Ensure the icon is invisible to AT by wrapping it with <span aria-hidden="true" role="presentation">.

It was suggested to add title to the icon to replace <span>Emergency Alerts</span>, but took this approach to allow the icon for other use just in case if such needs arise in the future.

Alert Message

Create the semantics between the alert message and its contained link by replacing <div> container with <p>.

To maintain valid HTML, all nested <div>s inside the <p class="ma__emergency-alert"> are replaced with <span>s.

CSS changes

To maintain the same visual as the original code's, some adjustment was added to related styles. The affected styles are all emergency alert specific ones, wouldn't affect other part of the page elements.

Outcome with This PR

  1. No visual changes.
  2. HTML output
<section class="ma__emergency-alerts js-accordion js-emergency-alerts" data-id="1488812019">
  <div class="ma__emergency-alerts__header">
    <div class="ma__emergency-alerts__container">
      <h2 class="ma__emergency-header">
        <div class="ma__emergency-header__label">
            <svg aria-hidden="true" id="SvgjsSvg1000" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs" width="48" height="44" viewBox="0 0 48 44"><defs id="SvgjsDefs1001"/><path id="SvgjsPath1007" d="..."/></svg>   
          <span>Emergency Alerts</span>
        </div>
        <div class="ma__emergency-header__title">emergency alert headline 2</div>
      </h2>
      <div class="ma__emergency-alerts__header-interface js-accordion-link">
        <button class="ma__button-alert">
          <span class="ma__button-alert__hide">hide</span>
          <span class="ma__button-alert__show">show</span> alerts
        </button>
      </div>
    </div>
  </div>

  <div class="ma__emergency-alerts__content js-accordion-content" style="display: none;">
    <div class="ma__emergency-alerts__container">
      <p class="ma__emergency-alert" tabindex="0">
        <span class="ma__emergency-alert__message">emergency alert message <span class="ma__emergency-alert__time-stamp">03.06.17, 9:53 am</span></span>
        <span class="ma__emergency-alert__link">
          <a class="ma__content-link ma__content-link--chevron" href="/alerts#13613"><span>more</span></a>
        </span>
      </p>
      <p class="ma__emergency-alert" tabindex="0">
        <span class="ma__emergency-alert__message">emergency alert message2 <span class="ma__emergency-alert__time-stamp">03.06.17, 9:53 am</span></span>
        <span class="ma__emergency-alert__link">
          <a class="ma__content-link ma__content-link--chevron" href="/alerts#13614"><span>see more</span></a>
        </span>
      </p>
    </div>
  </div>
  <div class="ma__emergency-alerts__interface js-accordion-link">
    <button class="ma__button-alert">
      <span class="ma__button-alert__hide">hide</span>
      <span class="ma__button-alert__show">show</span> alerts
    </button>
  </div>
</section>

Testing

  1. Check for above code in HTML
  2. The visual maintains the current one. See the screenshots.
    alert_close
    alert_open
  3. Screen readers should
    • announce the alert label text as a part of the alert title, "emergency alerts emergency alert headline 2",
    • recognize the link within <p class="ma__emergency-alert"> is associated with the alert message.

@mrossi113
Copy link
Contributor

Testing-DP-1854

  • Type in URL http://localhost:3000/?p=organisms-emergency-alerts
  • Than tab until user come to "show alert" click return to show the alerts the focus should stay on "hide alerts"
  • Next time the user tabs it should go to "MassPort is operating..." and through each message alert.

@mrossi113 mrossi113 assigned powpow12 and unassigned mrossi113 Mar 6, 2017
Copy link

@legostud legostud left a comment

Choose a reason for hiding this comment

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

This first obvious issue I see is that the styling for this no longer correct. Desktop is too tall, icon has grown in size, and as you shrink the width of the browser the items no longer wrap correctly.

When making changes to html, please, always compare the styling between your local:
localhost:3000/?p=organisms-emergency-alerts
and prod:
http://mayflower.digital.mass.gov/?p=organisms-emergency-alerts

<div class="ma__emergency-header__label">
{% include "@atoms/05-icons/svg-alert.twig" %}
<span aria-hidden="true" role="presentation">{% include "@atoms/05-icons/svg-alert.twig" %}</span>
Copy link

Choose a reason for hiding this comment

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

this isn't needed. All svg icons already have aria-hidden on the SVG element. We determined this to be the more common use case for icons.

Copy link

Choose a reason for hiding this comment

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

Also adding a layer of nesting broken the CSS on the icon (it's too large)

.ma__emergency-header__label > svg {
height: 32px;
width: 36px;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will remove the span.

<div class="ma__emergency-alert__link">
<p class="ma__emergency-alert" tabindex="0">
<span class="ma__emergency-alert__message">{{ emergencyAlert.message }} <span class="ma__emergency-alert__time-stamp">{{ emergencyAlert.timeStamp }}</span></span>
<span class="ma__emergency-alert__link">
Copy link

Choose a reason for hiding this comment

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

This is technically correct in that you are just replacing the div with a span. Looking beyond that, it appears that the if statement was placed in the wrong spot originally. The "ma__emergency-alert__link" span tags should be inside the if statement to prevent rendering and empty span tag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The if statement for the link has been moved outside to wrap <span class="ma__emergency-alert__link"> to prevent empty <span>.

@@ -1,3 +1,8 @@
h2.ma__emergency-header {
Copy link

Choose a reason for hiding this comment

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

using h2. isn't necessary or desired. This adds an extra layer of specificity that doesn't appear to be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will remove this section.

font-size: 1.375rem;
line-height: 1.5em;
}

Copy link

Choose a reason for hiding this comment

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

Using inherit would probably be better than setting this, but I could go either way.
font-size: inherit;
line-height: inherit;

you also need to add margin: 0; to this to correct the styling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These styles are added to .ma__emergency-header.

Copy link

@legostud legostud Mar 7, 2017

Choose a reason for hiding this comment

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

There are still styling issues. Maybe I confused things with the above comment "correct the styling" that was just to fix the header. let me know if you would like some help fixing the other styling issues.

@powpow12
Copy link
Contributor

powpow12 commented Mar 8, 2017

@ygannett I am running into a local bug with my mayflower implementation so I cannot troubleshoot the code well but I do see some visual differences.

  • Align to the left
  • Missing button
  • Alerts accordion starts opened

image

@isaacchansky isaacchansky self-requested a review March 8, 2017 20:28
@isaacchansky
Copy link
Contributor

isaacchansky commented Mar 8, 2017

I'm not seeing any visual difference between the local build & the mayflower.digital.mass version (see gif of me switching between local & mayflower.digital.mass version)

@legostud are you still noticing differences?

alerts-comparison

@legostud
Copy link

legostud commented Mar 9, 2017

It looks fine to me now.

@legostud
Copy link

legostud commented Mar 9, 2017

This Pull Request still says WIP, but I think it's okay to merge.

@ygannett
Copy link
Contributor Author

ygannett commented Mar 9, 2017

Thank you all for your help. I just removed the WIP label.

@legostud legostud merged commit cfbe068 into dev Mar 9, 2017
@ygannett ygannett deleted the a11y_alert_changes branch April 7, 2017 16:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants