Fix a few accessibility issues

This commit is contained in:
Benoit Marty 2019-09-23 16:17:28 +02:00 committed by Benoit Marty
parent 3fcfa33364
commit 620ba279d8
9 changed files with 33 additions and 7 deletions

View file

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

View file

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

View file

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

View file

@ -17,6 +17,7 @@
android:id="@+id/createChatFabMenu" android:id="@+id/createChatFabMenu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:accessibilityTraversalBefore="@+id/roomListEpoxyRecyclerView"
android:visibility="gone" android:visibility="gone"
app:layoutDescription="@xml/motion_scene_fab_menu" app:layoutDescription="@xml/motion_scene_fab_menu"
tools:showPaths="true" tools:showPaths="true"
@ -30,6 +31,8 @@
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:accessibilityTraversalBefore="@+id/roomListEpoxyRecyclerView"
android:contentDescription="@string/a11y_create_direct_message"
android:scaleType="center" android:scaleType="center"
android:src="@drawable/ic_fab_add_chat" android:src="@drawable/ic_fab_add_chat"
android:visibility="gone" android:visibility="gone"
@ -45,6 +48,8 @@
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:accessibilityTraversalBefore="@+id/roomListEpoxyRecyclerView"
android:contentDescription="@string/a11y_create_room"
android:src="@drawable/ic_fab_add_room" android:src="@drawable/ic_fab_add_room"
android:visibility="gone" android:visibility="gone"
app:maxImageSize="32dp" app:maxImageSize="32dp"

View file

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

View file

@ -21,6 +21,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:contentDescription="@string/a11y_create_room"
android:src="@drawable/ic_fab_add_room" android:src="@drawable/ic_fab_add_room"
app:backgroundTint="#FFFFFF" app:backgroundTint="#FFFFFF"
app:fabCustomSize="48dp" app:fabCustomSize="48dp"
@ -43,6 +44,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:contentDescription="@string/a11y_create_direct_message"
android:src="@drawable/ic_fab_add_chat" android:src="@drawable/ic_fab_add_chat"
app:backgroundTint="#FFFFFF" app:backgroundTint="#FFFFFF"
app:fabCustomSize="48dp" app:fabCustomSize="48dp"
@ -64,6 +66,7 @@
android:id="@+id/createRoomButton" android:id="@+id/createRoomButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/a11y_create_menu"
android:src="@drawable/ic_fab_add" android:src="@drawable/ic_fab_add"
app:maxImageSize="14dp" /> app:maxImageSize="14dp" />

View file

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

View file

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

View file

@ -13,4 +13,12 @@
<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="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">Create…</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> </resources>