Skip to content

a11y: Make list and icon content descriptions translatable - #2068

Open
NAME-ASHWANIYADAV wants to merge 1 commit into
Igalia:mainfrom
NAME-ASHWANIYADAV:fix/a11y-hardcoded-content-descriptions
Open

a11y: Make list and icon content descriptions translatable#2068
NAME-ASHWANIYADAV wants to merge 1 commit into
Igalia:mainfrom
NAME-ASHWANIYADAV:fix/a11y-hardcoded-content-descriptions

Conversation

@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor

Fixes #2067

What

Replaces the fourteen hardcoded English android:contentDescription literals left in the layout tree with translatable @string references, adding thirteen strings to values/strings.xml (one is shared by two layouts), each with a translator comment in the style used by the existing *_content_description entries.

Layout Was Now
bookmarks.xml:106 "Bookmarks feed" bookmarks_list_content_description - "List of bookmarks"
history.xml:102 "History feed" history_list_content_description - "List of visited websites"
downloads.xml:82 "Downloads" downloads_list_content_description - "List of downloaded files"
system_notifications.xml:66 "System notifications" notifications_list_content_description - "List of notifications"
addons_list.xml:34 "Addons List" addons_list_content_description - "List of add-ons"
addon_options_permissions.xml:37 "Addons List" addons_permissions_list_content_description - "List of add-on permissions"
options_saved_logins.xml:93 "Logins List" privacy_options_saved_logins_list_content_description - "List of saved logins"
prompt_select_login.xml:42 "Saved Logins list" autofill_dialog_use_login_list_content_description - "List of saved logins to choose from"
options_custom_search_engines.xml:82 "Search Engines List" custom_search_engines_list_content_description - "List of custom search engines"
custom_search_engine_item.xml:87 "Delete custom search engine" custom_search_engine_item_delete_content_description - same text
navigation_url.xml:171, title_bar.xml:55 "SSL icon" insecure_connection_content_description - "Connection is not secure"
new_tab.xml:86 "Top sites" new_tab_top_sites_list_content_description - "List of most visited sites"
new_tab.xml:109 "Experiences" new_tab_experiences_list_content_description - "List of featured experiences"

Why

Hardcoded literals never reach the translation pipeline, so these announcements stay English in every locale. This clears the last of them: of the 38 android:contentDescription occurrences across all 157 layout files - every flavor directory included - the rest were already @string references.

Two of the fourteen also said the wrong thing, so the replacement is a copy fix as well as a translation one:

  • addon_options_permissions.xml:37 labelled @+id/permissions_list as "Addons List", but that list holds one add-on's requested permissions (AddonOptionsPermissionsView fills it from addon.translatePermissions(...)).
  • Both "SSL icon" sites are the same ic_icon_security_state_insecure drawable, shown only when viewmodel.isInsecureVisible. The label named the widget rather than the state, so it now says the connection is not secure. One string serves both layouts.

The remaining twelve keep their existing meaning and follow the "List of …" phrasing introduced by the two merged language-list descriptions. New strings were preferred over reusing nearby header strings so the list announcement does not simply repeat the visible header, and so list labels are not coupled to header wording.

Where each string is placed: next to the feature strings it belongs with (for example bookmarks_list_content_description right after bookmarks_loading), rather than appended at the end.

Related, left out deliberately

title_bar.xml:67 sets android:contentDescription="Page URL" on the @+id/url TextView. A contentDescription on a TextView replaces its text for accessibility services, which would normally mask the URL - but that view binds its text via tools:text="@{viewmodel.titleBarUrl}", a design-time attribute, so it appears not to be populated at runtime. Whether the right fix is to drop the description or to fix the binding depends on what the view actually renders, which I cannot check without a device, so I left it out rather than guess. Happy to file it separately.

Testing

  • Builds: ./gradlew assembleNoapiArm64GeckoGenericDebug
  • Existing unit tests pass: ./gradlew testNoapiArm64GeckoGenericDebugUnitTest

Checked without a build: all fourteen layouts and strings.xml parse; every new @string reference resolves to a string defined in values/strings.xml; no duplicate string names; and none of the thirteen new names already exists in any values-* translation file.

Fourteen layouts hardcoded English content descriptions, so screen
readers announced untranslated text. Two of them were also wrong: the
add-on permissions list claimed to be the add-ons list, and the SSL
icon named the widget rather than the connection state.
@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor Author

@svillar PTAL !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hardcoded English content descriptions in fourteen layouts, two of them inaccurate

1 participant