Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding aria-labelledby to .timePosted for accessibility #163

Closed
adamjohnson opened this issue Mar 6, 2018 · 4 comments
Closed

Comments

@adamjohnson
Copy link

Example of where to use aria-labelledby on Tweet time

Steps to reproduce the issue

  1. Use Twitter Post Fetcher and output tweets with .timePosted visible.
  2. Make sure multiple tweets from the same day are visible (like in the image above).

Results

Twitter Post Fetcher will output links like "Posted on March 1, 2018" for each tweet posted on March 1st.

Request

WCAG 2.0 suggests links with the same link text to use either aria-labelledby or aria-label. Would you consider adding aria-labelledby to .timePosted? The aria-labelledby can point to .tweet.

Here's the spec. The Siteimprove Chrome Extension is a great tool to help test accessibility issues like this. MDN Docs for aria-labelledby.

@jasonmayes
Copy link
Owner

This is simply taking whatever Twitter passes back to us int he JSON object and outputs that. If you want to re-format you would need to write a custom function to call upon all date fields returned.

@jasonmayes
Copy link
Owner

jasonmayes commented Mar 9, 2018

Oh wait you are saying to add that class to our output? Eg https://github.com/jasonmayes/Twitter-Post-Fetcher/blob/master/js/twitterFetcher.js#L361 and the lines below that also inject that classname

@jasonmayes jasonmayes reopened this Mar 9, 2018
@adamjohnson
Copy link
Author

This is what we implemented:

https://www.diffchecker.com/c6wmeUaz

The tweet receives an id, then the aria-labelledby is added to the anchor tag for the time posted.

Here's an HTML example:

<ul>
  <li>
    <p class="tweet" id="tweet--1">Hey, this is my first tweet!</p>
    <p class="timePosted">
      <a href="#" aria-labelledby="tweet--1">Posted on Mar 8, 2018</a>
    </p>
  </li>

  <li>
    <p class="tweet" id="tweet--2">This is my second tweet.</p>
    <p class="timePosted">
      <a href="#" aria-labelledby="tweet--2">Posted on Mar 8, 2018</a>
    </p>
  </li>
</ul>

@jasonmayes
Copy link
Owner

Closing as this can be achieved using advanced example and constructing own html if needed.

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

No branches or pull requests

2 participants