Skip to content

fix: 🐛 fix semantics issue when using go router (#622)#625

Open
Sahil-Simform wants to merge 1 commit into
masterfrom
fix/issue_622_semantics_issue
Open

fix: 🐛 fix semantics issue when using go router (#622)#625
Sahil-Simform wants to merge 1 commit into
masterfrom
fix/issue_622_semantics_issue

Conversation

@Sahil-Simform

Copy link
Copy Markdown
Contributor

Description

While using go_router with showSemanticsDebugger = true, the title and description are not visible in the semantics debug view, even though accessibility works as expected. This PR resolves the issue.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #622

Before:
Screenshot_20260122_141032

After:

Screenshot_20260122_140907

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a semantics debugger visibility issue where Showcase title/description nodes don’t appear when using go_router with showSemanticsDebugger = true.

Changes:

  • Wrap the overlay tree with a Semantics widget in OverlayManager to influence semantics propagation/visibility.
  • Add a changelog entry referencing the fix for #622.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lib/src/utils/overlay_manager.dart Adds a top-level Semantics wrapper around the overlay subtree.
CHANGELOG.md Documents the fix for issue #622 in the unreleased section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +216 to 231
// Wrapping with Semantics to control accessibility based on
// `isSemanticsEnabled` flag.
return Semantics(
liveRegion: showcaseView.semanticEnable,
excludeSemantics: !showcaseView.semanticEnable,
child: Directionality(
textDirection: inheritedData.textDirection,
child: MediaQuery(
data: inheritedData.mediaQuery,
child: DefaultTextStyle(
style: inheritedData.textStyle,
child: themedChild,
),
),
),
);

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excludeSemantics: !showcaseView.semanticEnable changes behavior when semanticEnable is false by actively stripping all descendant semantics for the overlay (including default semantics from Text/buttons). Elsewhere in the codebase semanticEnable is used to add extra semantics (e.g., live regions) rather than remove existing semantics, so this is likely an unintended/breaking change.

Consider only wrapping with Semantics when semanticEnable is true (and omit excludeSemantics), or use Semantics(container: true, explicitChildNodes: true, ...) to fix the debugger visibility without disabling semantics when the flag is false.

Suggested change
// Wrapping with Semantics to control accessibility based on
// `isSemanticsEnabled` flag.
return Semantics(
liveRegion: showcaseView.semanticEnable,
excludeSemantics: !showcaseView.semanticEnable,
child: Directionality(
textDirection: inheritedData.textDirection,
child: MediaQuery(
data: inheritedData.mediaQuery,
child: DefaultTextStyle(
style: inheritedData.textStyle,
child: themedChild,
),
),
),
);
final overlayContent = Directionality(
textDirection: inheritedData.textDirection,
child: MediaQuery(
data: inheritedData.mediaQuery,
child: DefaultTextStyle(
style: inheritedData.textStyle,
child: themedChild,
),
),
);
// Only add showcase-specific semantics when explicitly enabled.
// When disabled, preserve descendant widgets' default semantics instead of
// stripping them from the overlay subtree.
if (showcaseView.semanticEnable) {
return Semantics(
liveRegion: true,
child: overlayContent,
);
}
return overlayContent;

Copilot uses AI. Check for mistakes.
style: inheritedData.textStyle,
child: themedChild,
// Wrapping with Semantics to control accessibility based on
// `isSemanticsEnabled` flag.

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment references an isSemanticsEnabled flag, but the actual configuration being used is showcaseView.semanticEnable. Updating the comment to match the real API will avoid confusion for future maintainers.

Suggested change
// `isSemanticsEnabled` flag.
// `showcaseView.semanticEnable`.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new option "semanticEnable" don't work (title and description)

2 participants