Merge pull request #581 from vector-im/feature/talk_back

Fix a few accessibility issues
This commit is contained in:
Benoit Marty 2019-09-24 10:06:28 +02:00 committed by GitHub
commit 5cc3dc00e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 54 additions and 8 deletions

View File

@ -10,7 +10,7 @@ Improvements:
- Remove any notification of a redacted event (#563)
Other changes:
-
- Fix a few accessibility issues
Bugfix:
- Fix characters erased from the Search field when the result are coming (#545)

View File

@ -63,6 +63,18 @@ class FabMenuView @JvmOverloads constructor(context: Context, attrs: AttributeSe
}
}
override fun transitionToEnd() {
super.transitionToEnd()
createRoomButton.contentDescription = context.getString(R.string.a11y_create_menu_close)
}
override fun transitionToStart() {
super.transitionToStart()
createRoomButton.contentDescription = context.getString(R.string.a11y_create_menu_open)
}
fun show() {
isVisible = true
createRoomButton.show()

View File

@ -68,6 +68,8 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
val (width, height) = processSize(data, mode)
imageView.layoutParams.height = height
imageView.layoutParams.width = width
// a11y
imageView.contentDescription = data.filename
createGlideRequest(data, mode, imageView, width, height)
.dontAnimate()
@ -80,6 +82,9 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
fun renderFitTarget(data: Data, mode: Mode, imageView: ImageView, callback: ((Boolean) -> Unit)? = null) {
val (width, height) = processSize(data, mode)
// a11y
imageView.contentDescription = data.filename
createGlideRequest(data, mode, imageView, width, height)
.listener(object : RequestListener<Drawable> {
override fun onLoadFailed(e: GlideException?,
@ -127,6 +132,9 @@ class ImageContentRenderer @Inject constructor(private val activeSessionHolder:
}
fun render(data: Data, imageView: BigImageView) {
// a11y
imageView.contentDescription = data.filename
val (width, height) = processSize(data, Mode.THUMBNAIL)
val contentUrlResolver = activeSessionHolder.getActiveSession().contentUrlResolver()
val fullSize = contentUrlResolver.resolveFullSize(data.url)

View File

@ -25,6 +25,7 @@
android:id="@+id/groupToolbarAvatarImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/a11y_open_drawer"
tools:src="@tools:sample/avatars" />
<TextView

View File

@ -30,6 +30,8 @@
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:accessibilityTraversalBefore="@+id/roomListEpoxyRecyclerView"
android:contentDescription="@string/a11y_create_direct_message"
android:scaleType="center"
android:src="@drawable/ic_fab_add_chat"
android:visibility="gone"
@ -45,6 +47,8 @@
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:accessibilityTraversalBefore="@+id/roomListEpoxyRecyclerView"
android:contentDescription="@string/a11y_create_room"
android:src="@drawable/ic_fab_add_room"
android:visibility="gone"
app:maxImageSize="32dp"

View File

@ -71,6 +71,7 @@
android:layout_width="22dp"
android:layout_height="22dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/action_close"
android:src="@drawable/ic_close_round"
android:tint="@color/riotx_notice"
tools:ignore="MissingConstraints" />
@ -88,6 +89,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/send_attachment"
android:src="@drawable/ic_attachment"
android:tint="?attr/colorAccent"
tools:ignore="MissingConstraints" />
@ -107,6 +109,7 @@
android:layout_width="0dp"
android:layout_height="0dp"
android:background="?android:attr/selectableItemBackground"
android:contentDescription="@string/send"
android:src="@drawable/ic_send"
android:tint="?attr/colorAccent"
tools:ignore="MissingConstraints" />

View File

@ -13,7 +13,10 @@
android:id="@+id/createRoomTouchGuard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?riotx_touch_guard_bg" />
android:background="?riotx_touch_guard_bg"
android:clickable="true"
android:contentDescription="@string/a11y_create_menu_close"
android:focusable="true" />
<!-- Sub menu item 2 -->
<com.google.android.material.floatingactionbutton.FloatingActionButton
@ -21,6 +24,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:accessibilityTraversalBefore="@+id/roomListEpoxyRecyclerView"
android:contentDescription="@string/a11y_create_room"
android:src="@drawable/ic_fab_add_room"
app:backgroundTint="#FFFFFF"
app:fabCustomSize="48dp"
@ -35,6 +40,7 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:ellipsize="end"
android:importantForAccessibility="no"
android:text="@string/fab_menu_create_room" />
<!-- Sub menu item 1 -->
@ -43,6 +49,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:accessibilityTraversalBefore="@+id/createRoomItemGroup"
android:contentDescription="@string/a11y_create_direct_message"
android:src="@drawable/ic_fab_add_chat"
app:backgroundTint="#FFFFFF"
app:fabCustomSize="48dp"
@ -57,6 +65,7 @@
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:ellipsize="end"
android:importantForAccessibility="no"
android:text="@string/fab_menu_create_chat" />
<!-- Menu -->
@ -64,6 +73,8 @@
android:id="@+id/createRoomButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:accessibilityTraversalBefore="@+id/createRoomItemChat"
android:contentDescription="@string/a11y_create_menu_open"
android:src="@drawable/ic_fab_add"
app:maxImageSize="14dp" />

View File

@ -106,6 +106,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:contentDescription="@string/a11y_close_keys_backup_banner"
android:src="@drawable/ic_small_close"
app:layout_constraintEnd_toEndOf="@id/view_keys_backup_banner_close"
app:layout_constraintStart_toStartOf="@id/view_keys_backup_banner_close"

View File

@ -3,23 +3,20 @@
<item
android:id="@+id/bottom_action_home"
android:contentDescription="@string/bottom_action_home"
android:enabled="true"
android:icon="@drawable/ic_home_bottom_catchup"
android:title="" />
android:title="@string/bottom_action_home" />
<item
android:id="@+id/bottom_action_people"
android:contentDescription="@string/bottom_action_people_x"
android:enabled="true"
android:icon="@drawable/ic_home_bottom_chat"
android:title="" />
android:title="@string/bottom_action_people_x" />
<item
android:id="@+id/bottom_action_rooms"
android:contentDescription="@string/bottom_action_rooms"
android:enabled="true"
android:icon="@drawable/ic_home_bottom_group"
android:title="" />
android:title="@string/bottom_action_rooms" />
</menu>

View File

@ -13,4 +13,13 @@
<string name="error_network_timeout">Looks like the server is taking to long to respond, this can be caused by either poor connectivity or an error with our servers. Please try again in a while.</string>
<string name="send_attachment">Send attachment</string>
<string name="a11y_open_drawer">Open the navigation drawer</string>
<string name="a11y_create_menu_open">Open the create room menu</string>
<string name="a11y_create_menu_close">Close the create room menu…</string>
<string name="a11y_create_direct_message">Create a new direct conversation</string>
<string name="a11y_create_room">Create a new room</string>
<string name="a11y_close_keys_backup_banner">Close keys backup banner</string>
</resources>