fix: 🐛 fix semantics issue when using go router (#622)#625
fix: 🐛 fix semantics issue when using go router (#622)#625Sahil-Simform wants to merge 1 commit into
Conversation
22e3ade to
55f6395
Compare
There was a problem hiding this comment.
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
Semanticswidget inOverlayManagerto 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.
| // 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, | ||
| ), | ||
| ), | ||
| ), | ||
| ); |
There was a problem hiding this comment.
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.
| // 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; |
| style: inheritedData.textStyle, | ||
| child: themedChild, | ||
| // Wrapping with Semantics to control accessibility based on | ||
| // `isSemanticsEnabled` flag. |
There was a problem hiding this comment.
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.
| // `isSemanticsEnabled` flag. | |
| // `showcaseView.semanticEnable`. |
Description
While using
go_routerwithshowSemanticsDebugger = 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
fix:,feat:,docs:etc).docsand added dartdoc comments with///.examplesordocs.Breaking Change?
Related Issues
Closes #622
Before:

After: