Automated Code Fix Suggestions for Accessibility Issues in Mobile Apps

Forough Mehralian, Titus Barik, Jeffrey Nichols, Amanda SwearnginarXiv 2024

Abstract: Accessibility is crucial for inclusive app usability, yet developers often struggle to identify and fix app accessibility issues due to a lack of awareness, expertise, and inadequate tools. Current accessibility testing tools can identify accessibility issues but may not always provide guidance on how to address them. We introduce FixAlly, an automated tool designed to suggest source code fixes for accessibility issues detected by automated accessibility scanners. FixAlly employs a multi-agent LLM architecture to generate fix strategies, localize issues within the source code, and propose code modification suggestions to fix the accessibility issue. Our empirical study demonstrates FixAlly's capability in suggesting fixes that resolve issues found by accessibility scanners -- with an effectiveness of 77% in generating plausible fix suggestions -- and our survey of 12 iOS developers finds they would be willing to accept 69.4% of evaluated fix suggestions.

Introduction

While accessibility is vital for inclusive software, mobile apps are frequently released with significant barriers for users with disabilities. Existing tools like Apple’s Accessibility Inspector or Google’s Accessibility Scanner are effective at identifying violations—such as low color contrast or small touch targets—but they leave the most difficult tasks to the developer: locating the problematic code and determining a fix that preserves the app's design and functionality.

Formative interviews with developers revealed that localization—mapping a visual UI element to specific lines of code—is often the most frustrating part of the debugging process. Furthermore, accessibility fixes are rarely "one-size-fits-all"; a single issue might be resolved through various strategies, and the optimal choice depends heavily on the app's specific design goals. To bridge this gap, we present FixAlly, an automated tool that uses a multi-agent Large Language Model (LLM) architecture to detect, localize, and suggest code fixes for accessibility issues.

The FixAlly Architecture

FixAlly utilizes a multi-agent architecture, powered by GPT-4o, to mimic the workflow of a human developer. The system is organized into three primary modules that form a continuous feedback loop.

The FixAlly system architecture, showing the three-stage pipeline: Data Processing, Suggestion Generation (Planner, Localizer, Fixer), and Suggestion Assessment.

1. Data Processing

The tool instruments the target application and executes automated GUI tests to navigate various screens. During this process, it captures accessibility reports, screenshots, and the underlying UI structure.

2. Suggestion Generation

This core module employs three specialized agents:

  • The Planner: Analyzes the accessibility violation and suggests high-level natural language strategies (e.g., "increase the hit area by adding padding").
  • The Localizer: Employs a hybrid approach, using static analysis of the UI hierarchy to narrow down candidate files and LLM reasoning to identify the exact code snippet corresponding to the visual element.
  • The Fixer: Translates the plan and localized code into a specific code patch (diff).

3. Suggestion Assessment

FixAlly automatically attempts to build the patched version of the app and re-runs the accessibility scanner. If the fix fails to resolve the issue or introduces build errors, the system feeds these messages back to the agents for up to three iterations of self-reflection and repair.

Empirical Evaluation

We evaluated FixAlly using 205 accessibility issues identified across 14 open-source iOS apps built with SwiftUI. These issues spanned nine categories, including "Clipped text," "Contrast failed," and "Hit area too small."

Examples of FixAlly's generated suggestions for various accessibility issues, including small hit areas (a), multiple plans for clipped text (b), and maintaining design consistency for contrast issues (c).

Key Results

  • Effectiveness: FixAlly generated at least one plausible fix for 77% of the 205 issues tested. For 63% of issues, it provided two or more valid options, allowing developers to choose the fix that best aligned with their design intent.
  • Developer Acceptance: In a survey of 12 iOS developers, participants were willing to accept 69.4% of the suggested fixes, either as-is or with minor modifications.
  • Efficiency: The tool is highly efficient, taking an average of 54 seconds to propose alternative fixes at a cost of less than $1.00 per screen.

Discussion and Insights

Our study confirms that mapping visual UI bugs to declarative code (like SwiftUI) is a significant bottleneck. FixAlly’s hybrid localization—combining structural analysis with LLM reasoning—is a key innovation for navigating large codebases.

Furthermore, we found that design integrity is paramount. A fix that resolves an accessibility issue but compromises the app's aesthetic is likely to be rejected. FixAlly addresses this by providing multiple plausible options and can be instructed to maintain consistency (e.g., adjusting the font size of all related buttons in a toolbar simultaneously, rather than just the one triggering the violation).

Limitations and Future Work

Currently, FixAlly focuses on fixes within a single source file and lacks a holistic understanding of global style sheets or complex multi-file architectures. While the current implementation is tailored to iOS and SwiftUI, the underlying logic is platform-agnostic. Future work will focus on expanding the tool's scope to recognize and resolve related accessibility issues across multiple screens simultaneously.

Summary updated

BibTeX
@misc{mehralian2024automated,
  author = {Forough Mehralian and Titus Barik and Jeffrey Nichols and Amanda Swearngin},
  title = {{Automated Code Fix Suggestions for Accessibility Issues in Mobile Apps}},
  year = {2024},
  eprint = {2408.03827},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.03827},
}
Figure