-
Notifications
You must be signed in to change notification settings - Fork 4
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
ANDROID-13687 Improve Snackbar accessibility #358
Conversation
📱 New catalog for testing generated: Download |
52d4530
to
969f455
Compare
📱 New catalog for testing generated: Download |
snackbar.addCallback(object : BaseCallback<Snackbar>() { | ||
override fun onShown(transientBottomBar: Snackbar) { | ||
transientBottomBar.view.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED) | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to get the focus when it's opened
constraintSet.setMargin(action.id, ConstraintSet.END, context.resources.getDimensionPixelSize(R.dimen.mistica_snackbar_padding_horizontal)) | ||
constraintSet.setMargin(action.id, ConstraintSet.END, context.resources.getDimensionPixelSize(R.dimen.mistica_snackbar_action_horizontal_margin)) | ||
constraintSet.setMargin(action.id, ConstraintSet.BOTTOM, context.resources.getDimensionPixelSize(R.dimen.mistica_snackbar_action_vertical_margin)) | ||
constraintSet.setMargin(action.id, ConstraintSet.TOP, context.resources.getDimensionPixelSize(R.dimen.mistica_snackbar_action_vertical_margin)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I needed to adjust a bit the layout after changing to a Button
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
📱 New catalog for testing generated: Download |
📱 New catalog for testing generated: Download |
📱 New catalog for testing generated: Download |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚀
📱 New catalog for testing generated: Download |
LGTM, I have a question left: What happens when is a persistent snackbar displayed and a sheet is opened? the snackbar would remain under the sheet? |
@aweell right, the snack bar remains under the sheet. You can see it in this video: Screen_recording_20240624_125029.mp4 |
📱 New catalog for testing generated: Download |
🥅 What's the goal?
Improve Snackbar accessibility.
Old
The snackbar will get the focus when it is opened.New
The snackbar should no get the focus when it is shown, it will have focus in the default A11y order.
The snackbar should announce the message following this logic:
The main action will be spoken as a button with an optional custom content description.
The idea was not to introduce a breaking change with the content description, but after trying this version in android-messenger, for example in Java code, it is a breaking change.
🚧 How do we do it?
TextView
toButton
to improve the talkback message.☑️ Checks
🧪 How can I test this?
demo_new_snackbar_behavior.mp4