2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[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.
This commit is contained in:
Eitan Isaacson 2019-03-27 11:15:41 -07:00 committed by Sawyer Blatz
parent 9bd2028ee9
commit d0b7a2cb31
2 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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"