[fenix] Fixes https://github.com/mozilla-mobile/fenix/issues/1186: Make quick actions invisible to screen reader when collapsed.

The buttons in the quick actions sheet are not visible or interactive
when the sheet is collapsed. They should not be visible to AT users
either.
pull/600/head
Eitan Isaacson 6 years ago committed by Sawyer Blatz
parent 9bd2028ee9
commit d0b7a2cb31

@ -48,6 +48,17 @@ class QuickActionSheet @JvmOverloads constructor(
handle.setAccessibilityDelegate(HandleAccessibilityDelegate(quickActionSheetBehavior))
quickActionSheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(v: View, state: Int) {
updateImportantForAccessibility(state)
}
override fun onSlide(p0: View, p1: Float) {
}
})
updateImportantForAccessibility(quickActionSheetBehavior.state)
val settings = Settings.getInstance(context)
if (settings.shouldAutoBounceQuickActionSheet) {
settings.incrementAutomaticBounceQuickActionSheetCount()
@ -55,6 +66,14 @@ class QuickActionSheet @JvmOverloads constructor(
}
}
private fun updateImportantForAccessibility(state: Int) {
findViewById<LinearLayout>(R.id.quick_action_sheet_buttonbar).importantForAccessibility =
if (state == BottomSheetBehavior.STATE_COLLAPSED || state == BottomSheetBehavior.STATE_HIDDEN)
View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
else
View.IMPORTANT_FOR_ACCESSIBILITY_AUTO
}
private fun bounceSheet(
quickActionSheetBehavior: QuickActionSheetBehavior,
duration: Long = bounceAnimationLength

@ -21,6 +21,7 @@
android:src="@drawable/ic_drawer_pull_tab"/>
<LinearLayout
android:id="@+id/quick_action_sheet_buttonbar"
android:orientation="horizontal"
android:layout_gravity="bottom"
android:layout_width="match_parent"

Loading…
Cancel
Save