Productivity

flutter-improving-accessibility

flutter/skills · updated Apr 8, 2026

$npx skills add https://github.com/flutter/skills --skill flutter-improving-accessibility
summary

Configure Flutter apps for assistive technologies including screen readers and keyboard navigation.

  • Covers UI design fundamentals: font scaling, color contrast (4.5:1 for normal text, 3:1 for large), and 48x48 pixel minimum tap targets
  • Provides semantic annotation patterns using Semantics , MergeSemantics , and ExcludeSemantics widgets to expose widget tree structure to assistive tools
  • Includes web-specific guidance on enabling the semantics layer (disabled by default for performance
skill.md

Implementing Flutter Accessibility

Contents

UI Design and Styling

Design layouts to accommodate dynamic scaling and high visibility. Flutter automatically calculates font sizes based on OS-level accessibility settings.

  • Font Scaling: Ensure layouts provide sufficient room to render all contents when font sizes are increased to their maximum OS settings. Avoid hardcoding fixed heights on text containers.
  • Color Contrast: Maintain a contrast ratio of at least 4.5:1 for small text and 3.0:1 for large text (18pt+ regular or 14pt+ bold) to meet W3C standards.
  • Tap Targets: Enforce a minimum tap target size of 48x48 logical pixels to accommodate users with limited dexterity.

Accessibility Widgets

Utilize Flutter's catalog of accessibility widgets to manipulate the semantics tree exposed to assistive technologies (like TalkBack or VoiceOver).

  • Semantics: Use this to annotate the widget tree with a description of the meaning of the widgets. Assign specific roles using the SemanticsRole enum (e.g., button, link, heading) when building custom components.
  • MergeSemantics: Wrap composite widgets to merge the semantics of all descendants into a single selectable node for screen readers.
  • ExcludeSemantics: Use this to drop the semantics of all descendants, hiding redundant or purely decorative sub-widgets from accessibility tools.

Web Accessibility

Flutter web renders UI on a single canvas, requiring a specialized DOM layer to expose structure to browsers.

  • Enable Semantics: Web accessibility is disabled by default for performance. Users can enable it via an invisible button (aria-label="Enable accessibility").
  • Programmatic Enablement: If building a web-first application requiring default accessibility, force the semantics tree generation at startup.
  • Semantic Roles: Rely on standard widgets (TabBar, MenuAnchor, Table) for automatic ARIA role mapping. For custom components, explicitly assign SemanticsRole values to ensure screen readers interpret the elements correctly.

Adaptive and Responsive Design

Differentiate between adaptive and responsive paradigms to build universal applications.

  • Responsive Design: Adjust the placement, sizing, and reflowing of design elements to fit the available screen space.
  • Adaptive Design: Select appropriate layouts (e.g., bottom navigation vs. side panel) and input mechanisms (e.g., touch vs. mouse/keyboard) to make the UI usable within the current device context. Design to the strengths of each form factor.

Workflows

Task Progress: Accessibility Implementation

Copy this checklist to track accessibility compliance during UI development:

  • Verify all interactive elements have a minimum tap target of 48x48 pixels.
  • Test layout with maximum OS font size settings to ensure no text clipping or overflow occurs.
  • Validate color contrast ratios (4.5:1 for normal text, 3.0:1 for large text).
  • Wrap custom interactive widgets in Semantics and assign the appropriate SemanticsRole.
  • Group complex composite widgets using MergeSemantics to prevent screen reader fatigue.
  • Hide decorative elements from screen readers using ExcludeSemantics.
  • If targeting web, verify ARIA roles are correctly mapped and consider programmatic enablement of the semantics tree.

Feedback Loop: Accessibility Validation

Run this loop when finalizing a view or component:

  1. Run validator: Execute accessibility tests or use OS-level screen readers (VoiceOver/TalkBack) to navigate the view.
  2. Review errors: Identify unannounced interactive elements, trapped focus, or clipped text.
  3. Fix: Apply Semantics, adjust constraints, or modify colors. Repeat until the screen reader provides a clear, logical traversal of the UI.

Examples

Programmatic Web Accessibility Enablement

If targeting web and requiring accessibility by default, initialize the semantics binding before running the app.

import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter/foundation.dart';

void main() {
  if (kIsWeb) {
    SemanticsBinding.instance.ensureSemantics();
  }
  runApp(const MyApp());
}

Custom Component Semantics

If building a custom widget that acts as a list item, explicitly define its semantic role so assistive technologies and web ARIA mappings interpret it correctly.

import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';

class CustomListItem extends StatelessWidget {
  final String text;

  const CustomListItem({super.key, required this.text});

  
  Widget build(BuildContext context) {
    return Semantics(
      role: SemanticsRole.listItem,
      label: text,
      child: Padding(
        padding: const EdgeInsets.all(12.0), // Ensures > 48px tap target if interactive
        child: Text(
          text,
          style: const TextStyle(fontSize: 16), // Ensure contrast ratio > 4.5:1
        ),
      ),
    );
  }
}
general reviews

Ratings

4.672 reviews
  • Xiao Reddy· Dec 28, 2024

    Registry listing for flutter-improving-accessibility matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Amelia Rao· Dec 24, 2024

    Keeps context tight: flutter-improving-accessibility is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Pratham Ware· Dec 16, 2024

    We added flutter-improving-accessibility from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Dhruvi Jain· Dec 12, 2024

    I recommend flutter-improving-accessibility for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Amelia Ghosh· Dec 8, 2024

    flutter-improving-accessibility has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Sofia Smith· Dec 4, 2024

    flutter-improving-accessibility fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Alexander Martinez· Dec 4, 2024

    flutter-improving-accessibility fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Nikhil Rahman· Nov 27, 2024

    flutter-improving-accessibility reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Chen Sanchez· Nov 23, 2024

    Registry listing for flutter-improving-accessibility matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Kiara Choi· Nov 19, 2024

    flutter-improving-accessibility fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

showing 1-10 of 72

1 / 8