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

Missing Semantic Label #148

Closed
getBoolean opened this issue Feb 18, 2024 · 2 comments · Fixed by #150
Closed

Missing Semantic Label #148

getBoolean opened this issue Feb 18, 2024 · 2 comments · Fixed by #150
Labels
bug Something isn't working in triage

Comments

@getBoolean
Copy link

getBoolean commented Feb 18, 2024

Bug report

Describe the bug
Using accessibility_tools package to check for missing semantic labels, I found that WoltModalSheet.show does not give a semantic label for the dismissible GestureDetector.

flutter_boolean_template_kqm6AHtW0a

Steps to reproduce

Steps to reproduce the behavior:

  1. Using WoltModalSheet.show
Code: (click to expand)
abstract class HumanReadableEnum {
  const HumanReadableEnum();

  String get humanName;
}

enum ThemeType implements HumanReadableEnum {
  light('Light'),
  dark('Dark'),
  system('System');

  const ThemeType(this.humanName);

  @override
  final String humanName;
}

Future<OptionT?> showOptionsMenu<OptionT extends HumanReadableEnum>(
  BuildContext context, {
  required OptionT current,
  required List<OptionT> options,
  required String title,
}) async {
  return await WoltModalSheet.show<OptionT>(
    context: context,
    useRootNavigator: true,
    pageListBuilder: (BuildContext context) {
      final theme = Theme.of(context);
      return [
        SliverWoltModalSheetPage(
          topBarTitle: Center(
            child: Text(
              title,
              style: theme.textTheme.titleMedium,
            ),
          ),
          isTopBarLayerAlwaysVisible: true,
          leadingNavBarWidget: const Padding(
            padding: EdgeInsetsDirectional.all(16.0),
            child: CloseButton(),
          ),
          mainContentSlivers: [
            SliverList(
              delegate: SliverChildListDelegate([
                for (final eachOption in options)
                  ListTile(
                    title: Text(
                      eachOption.humanName,
                      style: current == eachOption
                          ? const TextStyle(
                              fontWeight: FontWeight.bold,
                            )
                          : null,
                    ),
                    onTap: () {
                      Navigator.of(context).pop(eachOption);
                    },
                    trailing:
                        current == eachOption ? const Icon(Icons.check) : null,
                  ),
              ]),
            ),
          ],
        ),
      ];
    },
  );
}

Expected behavior

It should be possible to add a semantic label to the dismissable GestureDetector, or exclude it from semantics if that information isn't important to a user using TalkBack/VoiceOver


Additional context

The problem seems to be with the GestureDetector in wolt_modal_sheet.dart at line 286

GestureDetector(
  behavior: HitTestBehavior.opaque,
  onTap: () {
    if (widget.route.barrierDismissible) {
      final onModalDismissedWithBarrierTap =
          widget.onModalDismissedWithBarrierTap;
      if (onModalDismissedWithBarrierTap != null) {
        onModalDismissedWithBarrierTap();
      } else {
        Navigator.of(context).pop();
      }
    }
  },
  child: const SizedBox.expand(),
)

@getBoolean getBoolean added bug Something isn't working in triage labels Feb 18, 2024
@ulusoyca
Copy link
Collaborator

ulusoyca commented Feb 19, 2024

@getBoolean Thanks for the detailed issue. This is an easy fix and should be high priority. Added to the backlog of next release. If you are interested in, feel free to create a PR.

@ulusoyca
Copy link
Collaborator

ulusoyca commented Mar 5, 2024

@getBoolean Can you check this PR? I believe Furkan's contribution will fix this. #150

@github-project-automation github-project-automation bot moved this from 🔖 Backlog to ✅ Done in WoltModalSheet Backlog Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working in triage
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants