DEV Community

Cover image for AI isn't the solution to all problems
Christopher Harrison for GitHub

Posted on

AI isn't the solution to all problems

There's an old saying "If the only tool you have is a hammer, everything looks like a nail." The basic message is if you're using a single solution you're likely to force its usage to solve every problem, even if it isn't the best tool for the job. This is a trap we often fall into when we're handed a new shiny tool, like AI. We immediately want to apply it to every scenario, even when there are existing options which are better equipped. I'm seeing this quite a bit these days with AI, with new products capturing the imagination of developers everywhere. But before we reach for AI we need to stop to ask if this is the right tool or is a better tool already available.

As an example, I recently attended a hackathon where a team was building an app to help developers create accessible websites. They were asking questions about how to incorporate AI into the process, using AI to detect accessibility shortcomings. As it turns out, this is a solved problem.

Looking at web development specifically, there's a set of clearly defined standards. There are numerous tools, including Visual Studio Code extensions and GitHub actions which can detect and report on gaps in compliance. Because detection is pattern based, there isn't a need for the dynamic capabilities AI would bring to the table. While it's certainly possible to build a new AI-driven tool, it wouldn't improve the process. This falls into the "hammer/nail" category.

However, there is a space where AI an help developers improve the accessibility of the apps they build. When we look at existing tools, the feedback provided to developers is relatively generic. An error might be raised indicating an alt attribute is missing from an img tag, but it would likely lack explanatory context. It's always better for someone to truly understand the rationale behind a rule rather than following the rule "because someone said so." Why is the alt attribute important? What makes for good alt text? What are the best practices?

Using a tool like GitHub Copilot Chat, a developer could highlight a block of code and ask questions like the ones listed above. It's a great opportunity to interactively learn more about accessibility, the experience different users have on a website, and how best to ensure the pages they build are usable by everyone. The information will be contextual to their specific situation, making it more relevant and impactful to the developer.

GitHub Copilot can also aid developers in creating accessible code. GitHub Copilot offers suggestions based both on its model and the current development context. If the HTML the developer is editing follows good accessibility practices, GitHub Copilot is more likely to make suggestions which do the same. A developer can also prompt GitHub Copilot by saying things like "Create a link to /login using the login.png image ensuring accessibility", which helps guide the suggestions generated.

In the end, we use different tools with different technologies to help our developers create accessible web pages. Extensions in the IDE alert to potential gaps. Automation integrated into the CI process catch issues before they're merged into the codebase. And finally AI helps the developer write better code, gain context and learn about accessibility.

All of us have a propensity to fall into the trap of wanting to use the cool new technology anywhere and everywhere, even if it's not an appropriate application. We always need to stop for a minute to ensure we're using the right tool, that we're not simply hammering everything as not everything is a nail. AI doesn't replace existing tools and solutions; it's another tool we can use to enhance and improve what we already have.

Top comments (5)

Collapse
 
crystalsolenoid profile image
Quinten Konyn • Edited

So true, but I think we've got to take it a bit farther.

There's these very cool supplemental-to-the-WCAG documents that help people think about why certain guidelines are the way they are, like these user stories related to cognitive disabilities. That's an amazing resource we have for free, and it's probably a great way to supplement the even more amazing resource of real-life user feedback! It's just hard to sift through if you don't already know what you're ctrl+f'ing for.

I would be very worried about an AI service that tried to explain why certain guidelines were necessary, but I wonder if they could help somehow with discoverability of the information in epic-length, expert-written documents like those supplemental guidelines.

Fun story, I was playing around on chatgpt today, pretending to be a new developer who knew to value accessibility, but had no intuition for it yet. I asked if it could help show me how to do a marquee and it said "no, that's deprecated and inaccessible" so I said "oh okay, how could I make text scroll across the screen in an an accessible way?" and it happily wrote up some (very buggy) css animations code to make some "accessible" scrolling text. It was hideous and distracting and very very funny. (It also gave my animated bouncing links aria labels and roles that <a>'s already implicitly have when I asked it to help me make the site "more accessible".)

...So I think it's at least as bad as the developers at just parroting accessibility rules of thumb without being able to generalize. I certainly wouldn't want to leave one in the room with an impressionable new accessibility student unsupervised.

Collapse
 
geektrainer profile image
Christopher Harrison

I agree. I think one place where ChatGPT (or GitHub Copilot Chat he says with a smile) can help is better describing the rationale behind the WCAG guidance. But as your experience demonstrated, it does depend and it does sometimes need guidance. I don't think someone could learn accessibility from AI, but I think it could further enhance their understanding.

The switch flipped for me in better understanding accessibility when I heard a screen reader for the first time. The experience others had became "real" to me as it was a site I was building.

In turn, being able to ask ChatGPT or another tool "Is this accessible" and the important follow-up of "Why isn't this accessible" helps the developer learn in real-time on a specific scenario they're currently working on. This is far more impactful, as you mention, than simply giving someone a list of rules and saying "just do this."

Collapse
 
manchicken profile image
Mike Stemle

This. Right here. Yes.

Collapse
 
princekwasi4 profile image
High Gardens ⛰️

Great

Collapse
 
arkalsekar profile image
Abdul Rehman Kalsekar

Great Post