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

Add unique name for link for accessibility #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tboggia
Copy link

@tboggia tboggia commented Nov 16, 2018

In cases where there are more than one Add to Calendar button per page, the various links need to be unique in order for users of assistive technology to be able to differentiate them.

Accessibility-wise, a link that simply says 'Google Calendar' isn't descriptive enough for someone using a screen reader to be able to use it to navigate successfullly.

This is my first time contributing to an open source thing, so please let me know if I'm doing this all wrong.

In cases where there are more than one Add to Calendar button per page, the various links need to be unique in order for users of assistive technology to be able to differentiate them.

Accessibility-wise, a link that simply says 'Google Calendar' isn't descriptive enough for someone using a screen reader to be able to use it to navigate successfullly.

This is my first time contributing to an open source thing, so please let me know if I'm doing this all wrong.
@tboggia
Copy link
Author

tboggia commented Nov 16, 2018

Hi @carlsednaoui !

In implementing your calendar tool on my site (UC Berkeley Extension), I also added this function to make it work with an existing way I was implementing calendars (using a recently paywalled library, ugh). Basically my XML feed builds a div with the fields in spans, then the function plugs those spans into your createCalendar function. If you are interested, I'll do another pull request for it.

if (calendarItems) {
  for ( var i = 0 ; i < calendarItems.length ; i++ ) {
    var thisItem = calendarItems[i],
        itemCalendarObject = {}, 
        myCalendar, itemClass, itemId, title, start, duration, end, address, description;
    itemCalendarObject.options = {};
    itemCalendarObject.data = {};
    
    for ( var p = 0 ; p < thisItem.children.length ; p++ ) {
      var thisField = thisItem.children[p],
          thisValue = thisField.innerText;
      switch(thisField.classList[0]) {
        case "itemClass": 
          itemCalendarObject.options.class = thisValue;
          break;
        case "itemId": 
          itemCalendarObject.options.id = thisValue;
          break;
        case "start": 
        case "end": 
          if ( thisValue.slice(-1) === "Z" ) {
            thisValue = thisValue.split('');
            thisValue.splice(4,0,'-');
            thisValue.splice(7,0,'-');
            thisValue.splice(13,0,':');
            thisValue.pop();
            thisValue = thisValue.join('');
          }
          itemCalendarObject.data[thisField.classList[0]] = new Date(thisValue);
          break;
        default:
          itemCalendarObject.data[thisField.classList[0]] = thisValue;
          break;
      }
    }

    myCalendar = createCalendar(itemCalendarObject);
    calendarItems[i].appendChild(myCalendar);
  }
}```

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.

None yet

1 participant