My First Open Source Contribution
Tags: opensource, restapi, webdev, a11y
Published: 2023-10-28 11:44:27

I'm a web developer. I'm a person with a disability. My experience of accessibility barriers spurs me to contribute to improving web accessibility.

## Discovering the Issue

Late in 2022, I was hunting for project ideas to showcase my skills in front-end development. So, I chose the [REST Countries challenge on Frontend Mentor](https://www.frontendmentor.io/challenges/rest-countries-api-with-color-theme-switcher-5cacc469fec04111f7b848ca). The challenge was to build a website that displays the flag and other details about countries in the world. The REST Countries API would provide data for use.

First, I queried the API endpoints to study the data returned. I immediately noticed that there were no descriptions of the flag images for use as alt text. I searched the Web to find a beginner-friendly and open-source API that provided this information but I came up short. So, I thought, “Why not add this data to the API? Surely, web developers would be more likely to provide alt text for images if there’s an easy way to do it.”

I studied the [API repository hosted on GitLab](https://gitlab.com/restcountries/restcountries/-/tree/master). Then, I retrieved the names of all 194 sovereign countries into a json file and got to work on the flag descriptions. I identified my target audience as anyone who couldn’t see the flag images. These include blind users, persons with low vision or limited colour-vision, and those who turn off or can’t load images.

## Writing the Flag Descriptions

I used a [Wikipedia post on sovereign countries’ flags](https://en.wikipedia.org/wiki/Gallery_of_sovereign_state_flags) as base material, along with several other posts I found on the Web. To improve my knowledge of alt text writing, I read several related posts on the a11y Slack workspace. I wrote, deleted and re-wrote the flag descriptions as I learnt and re-learnt. There were days when I thought, “Is this what I should be doing right now? Shouldn't I be focusing on front-end development?” But then I'd recall instances where accessibility barriers limited my ability to take part in social activities. I'd imagine how different it'd have been if someone had done the work to ensure I had an accessible experience.

## API Integration

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tyvf8sl1nwtj8vkej58o.PNG" alt="An excerpt of the REST Countries API data showing, among other fields, the alt field with a flag description for Angola.">
  <figcaption>**Flag description integrated into the API**</figcaption>
</figure>

It took over two months of writing to get to a point where I was ready to publish. Then, I wrote a Python script to add a new flag description field for each sovereign country in the API. I made a [pull request to the API repository](https://gitlab.com/restcountries/restcountries/-/merge_requests/57). I got feedback that it'd be better to add an alt field into the API's flags field instead to preserve backwards compatibility. So, I wrote another Python script and made the recommended changes. Finally, my contribution was merged into the API. I still recall that day with a smile. It was one of my most memorable moments ever.