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

Enabling semantics debugger shifts display #1140

Open
andyhorn opened this issue Feb 2, 2024 · 1 comment
Open

Enabling semantics debugger shifts display #1140

andyhorn opened this issue Feb 2, 2024 · 1 comment
Labels
p: core Related to `widgetbook` package t: bug Something isn't working

Comments

@andyhorn
Copy link

andyhorn commented Feb 2, 2024

Description

If I enable the semantics debugger, my widget is pushed to the right by the width of the Widgetbook navbar.

Steps To Reproduce

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:widgetbook/widgetbook.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  RendererBinding.instance.ensureSemantics();
  runApp(const WidgetbookApp());
}

class WidgetbookApp extends StatelessWidget {
  const WidgetbookApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Widgetbook.material(
      directories: [
        WidgetbookComponent(
          name: 'Example',
          useCases: [
            WidgetbookUseCase(
              name: 'Default',
              builder: (context) => const MyExampleWidget(),
            ),
          ],
        ),
      ],
      appBuilder: (context, child) => MaterialApp(
        showSemanticsDebugger: true,
        debugShowCheckedModeBanner: false,
        home: Scaffold(body: child),
      ),
    );
  }
}

class MyExampleWidget extends StatelessWidget {
  const MyExampleWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return const SizedBox(width: 400, child: Text('Example'));
  }
}

Expected Behavior

My widget is displayed in the same position, but with the semantics overlay. The navigation bar should not add semantics info that pushes my component off-screen.

Screenshots
Screenshot 2024-02-02 at 1 15 49 PM
Screenshot 2024-02-02 at 1 15 54 PM

@YoussefRaafatNasry YoussefRaafatNasry added t: bug Something isn't working p: core Related to `widgetbook` package labels Mar 15, 2024
@YoussefRaafatNasry
Copy link
Member

Hello @andyhorn 👋
Sorry for the late reply, we have been a bit busy releasing new features to Widgetbook Cloud.

Great job adding the details and the reproduction code as well.
My biggest suspect is the ExcludeSemantics widget used here:

We will look more into it, but feel free as well to submit a PR to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: core Related to `widgetbook` package t: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants