Conversation
PR Checks complete
Created with Flutter code quality action |
|
Visit the preview URL for this PR (updated for commit a9471d9): https://zeta-flutter-main--pr-424-ux-1563-k1vfuk8e.web.app (expires Mon, 09 Feb 2026 14:51:30 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 5ca681de0a0ad9185b252304c113355d5ee04ca6 |
There was a problem hiding this comment.
Pull request overview
This PR addresses a high contrast accessibility issue by forcing sharp borders on ZetaButton components when AAA contrast mode is enabled. The implementation adds logic to override the borderType parameter to ZetaWidgetBorder.sharp when the contrast level is set to AAA, improving visual clarity for users who require high contrast.
Changes:
- Added logic in
ZetaButton.build()to check the contrast level from the Zeta context - Introduced
contrastBorderTypevariable that enforces sharp borders in AAA contrast mode - The fix applies only to the
ZetaButtoncomponent, not to other button types or components
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| final contrastBorderType = zeta.contrast == ZetaContrast.aaa | ||
| ? ZetaWidgetBorder.sharp | ||
| : borderType ?? (context.rounded ? ZetaWidgetBorder.rounded : ZetaWidgetBorder.sharp); |
There was a problem hiding this comment.
This AAA contrast mode functionality lacks test coverage. The existing accessibility tests in button_test.dart iterate through contrast modes (aa and aaa) but don't specifically verify that sharp borders are enforced in AAA mode. Consider adding a test that verifies the border behavior in AAA contrast mode, especially when borderType is explicitly set to a different value.
There was a problem hiding this comment.
fair - will be done if solution is kept
Fixes the high contrast issue of borders not going sharp in high contrast mode for BUTTON ONLY.
This is not a global fix and ideally should be changed to a fix which targets all components.
The Issue
In the components, borderType overrides any border styles it may get from the parent.
This is why behaviour works properly when borderType isnt set (as it defaults to parent styling), but does not work when borderType is set manually by the user.
How can we override borderType globally without either:
Maybe a helper function to call on each component? Saves repetitive code but still requires component level adjustment...