Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android][FactSets]: Mark textViews important for accessibility explicitly #7452

Merged
merged 2 commits into from
May 19, 2022

Conversation

rankush
Copy link
Contributor

@rankush rankush commented May 13, 2022

Related Issue

Factset accessibility issue
Fixes #6752

Description

FactSets TextViews are wrapped under multiple ViewGroups, and further nesting, like having FactSets cards view under RecyclerViews is making Android accessibility services to skip factset data for talkBack (sometimes).
So marking these TextViews as important for accessibility explicitly

-- Newer API (for API26 and above) setScreenReaderFocusable() is used
-- Handled backward Compatibility also

Solution reference: Principles for improving app accessibility

Sample Card

Expense report example of Adaptive Cards Visualizer (sample app)

{
	"type": "AdaptiveCard",
	"body": [
		{
			"type": "Container",
			"style": "emphasis",
			"items": [
				{
					"type": "ColumnSet",
					"columns": [
						{
							"type": "Column",
							"items": [
								{
									"type": "TextBlock",
									"size": "large",
									"weight": "bolder",
									"text": "*EXPENSE APPROVAL*",
									"wrap": true,
									"style": "heading"
								}
							],
							"width": "stretch"
						},
						{
							"type": "Column",
							"items": [
								{
									"type": "Image",
									"url": "https://adaptivecards.io/content/pending.png",
									"height": "30px",
									"altText": "Pending"
								}
							],
							"width": "auto"
						}
					]
				}
			],
			"bleed": true
		},
		{
			"type": "Container",
			"items": [
				{
					"type": "ColumnSet",
					"columns": [
						{
							"type": "Column",
							"items": [
								{
									"type": "TextBlock",
									"size": "ExtraLarge",
									"text": "Trip to UAE",
									"wrap": true,
									"style": "heading"
								}
							],
							"width": "stretch"
						},
						{
							"type": "Column",
							"items": [
								{
									"type": "ActionSet",
									"actions": [
										{
											"type": "Action.OpenUrl",
											"title": "EXPORT AS PDF",
											"url": "https://adaptivecards.io"
										}
									]
								}
							],
							"width": "auto"
						}
					]
				},
				{
					"type": "TextBlock",
					"spacing": "small",
					"size": "small",
					"weight": "bolder",
					"text": "[ER-13052](https://adaptivecards.io)",
					"wrap": true
				},
				{
					"type": "FactSet",
					"spacing": "large",
					"facts": [
						{
							"title": "Submitted By",
							"value": "*Matt Hidinger*  matt@contoso.com"
						},
						{
							"title": "Duration",
							"value": "2019/06/19 - 2019/06/25"
						},
						{
							"title": "Submitted On",
							"value": "2019/04/14"
						},
						{
							"title": "Reimbursable Amount",
							"value": "$ 404.30"
						},
						{
							"title": "Awaiting approval from",
							"value": "*Thomas*  thomas@contoso.com"
						},
						{
							"title": "Submitted to",
							"value": "*David*  david@contoso.com"
						}
					]
				}
			]
		},
		{
			"type": "Container",
			"spacing": "large",
			"style": "emphasis",
			"items": [
				{
					"type": "ColumnSet",
					"columns": [
						{
							"type": "Column",
							"items": [
								{
									"type": "TextBlock",
									"weight": "bolder",
									"text": "DATE",
									"wrap": true
								}
							],
							"width": "auto"
						},
						{
							"type": "Column",
							"spacing": "large",
							"items": [
								{
									"type": "TextBlock",
									"weight": "bolder",
									"text": "CATEGORY",
									"wrap": true
								}
							],
							"width": "stretch"
						},
						{
							"type": "Column",
							"items": [
								{
									"type": "TextBlock",
									"weight": "bolder",
									"text": "AMOUNT",
									"wrap": true
								}
							],
							"width": "auto"
						}
					]
				}
			],
			"bleed": true
		},
		{
			"type": "ColumnSet",
			"columns": [
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"text": "06/19",
							"wrap": true
						}
					],
					"width": "auto"
				},
				{
					"type": "Column",
					"spacing": "medium",
					"items": [
						{
							"type": "TextBlock",
							"text": "Air Travel Expense",
							"wrap": true
						}
					],
					"width": "stretch"
				},
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"text": "$ 300",
							"wrap": true
						}
					],
					"width": "auto"
				},
				{
					"type": "Column",
					"spacing": "small",
					"verticalContentAlignment": "center",
					"items": [
						{
							"type": "Image",
							"id": "chevronDown1",
							"url": "https://adaptivecards.io/content/down.png",
							"width": "20px",
							"altText": "Air Travel Expense $300 collapsed"
						},
						{
							"type": "Image",
							"id": "chevronUp1",
							"isVisible": false,
							"url": "https://adaptivecards.io/content/up.png",
							"width": "20px",
							"altText": "Air Travel Expense $300 expanded"
						}
					],
					"selectAction": {
						"type": "Action.ToggleVisibility",
						"targetElements": [
							"cardContent1",
							"chevronUp1",
							"chevronDown1"
						]
					},
					"width": "auto"
				}
			]
		},
		{
			"type": "Container",
			"id": "cardContent1",
			"isVisible": false,
			"items": [
				{
					"type": "Container",
					"items": [
						{
							"type": "TextBlock",
							"text": "* Leg 1 on Tue, Jun 19th, 2019 at 6:00 AM.",
							"isSubtle": true,
							"wrap": true
						},
						{
							"type": "TextBlock",
							"text": "* Leg 2 on Tue,Jun 19th, 2019 at 7:15 PM.",
							"isSubtle": true,
							"wrap": true
						},
						{
							"type": "Container",
							"items": [
								{
									"type": "Input.Text",
									"id": "comment1",
									"label": "Add your comment here"
								}
							]
						}
					]
				},
				{
					"type": "Container",
					"items": [
						{
							"type": "ColumnSet",
							"columns": [
								{
									"type": "Column",
									"items": [
										{
											"type": "ActionSet",
											"actions": [
												{
													"type": "Action.Submit",
													"title": "Send",
													"data": {
														"id": "_qkQW8dJlUeLVi7ZMEzYVw",
														"action": "comment",
														"lineItem": 1
													}
												}
											]
										}
									],
									"width": "auto"
								}
							]
						}
					]
				}
			]
		},
		{
			"type": "ColumnSet",
			"columns": [
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"horizontalAlignment": "center",
							"text": "06/19",
							"wrap": true
						}
					],
					"width": "auto"
				},
				{
					"type": "Column",
					"spacing": "medium",
					"items": [
						{
							"type": "TextBlock",
							"text": "Auto Mobile Expense",
							"wrap": true
						}
					],
					"width": "stretch"
				},
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"text": "$ 100",
							"wrap": true
						}
					],
					"width": "auto"
				},
				{
					"type": "Column",
					"spacing": "small",
					"verticalContentAlignment": "Center",
					"items": [
						{
							"type": "Image",
							"id": "chevronDown2",
							"url": "https://adaptivecards.io/content/down.png",
							"width": "20px",
							"altText": "Auto Mobile Expense $100 collapsed"
						},
						{
							"type": "Image",
							"id": "chevronUp2",
							"isVisible": false,
							"url": "https://adaptivecards.io/content/up.png",
							"width": "20px",
							"altText": "Auto Mobile Expense $100 expanded"
						}
					],
					"selectAction": {
						"type": "Action.ToggleVisibility",
						"targetElements": [
							"cardContent2",
							"chevronUp2",
							"chevronDown2"
						]
					},
					"width": "auto"
				}
			]
		},
		{
			"type": "Container",
			"id": "cardContent2",
			"isVisible": false,
			"items": [
				{
					"type": "Container",
					"items": [
						{
							"type": "TextBlock",
							"text": "* Contoso Car Rentrals, Tues 6/19 at 7:00 AM",
							"isSubtle": true,
							"wrap": true
						},
						{
							"type": "Container",
							"items": [
								{
									"type": "Input.Text",
									"id": "comment2",
									"label": "Add your comment here"
								}
							]
						}
					]
				},
				{
					"type": "Container",
					"items": [
						{
							"type": "ColumnSet",
							"columns": [
								{
									"type": "Column",
									"items": [
										{
											"type": "ActionSet",
											"actions": [
												{
													"type": "Action.Submit",
													"title": "Send",
													"data": {
														"id": "_qkQW8dJlUeLVi7ZMEzYVw",
														"action": "comment",
														"lineItem": 2
													}
												}
											]
										}
									],
									"width": "auto"
								}
							]
						}
					]
				}
			]
		},
		{
			"type": "ColumnSet",
			"columns": [
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"horizontalAlignment": "center",
							"text": "06/25",
							"wrap": true
						}
					],
					"width": "auto"
				},
				{
					"type": "Column",
					"spacing": "medium",
					"items": [
						{
							"type": "TextBlock",
							"text": "Excess Baggage Cost",
							"wrap": true
						}
					],
					"width": "stretch"
				},
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"text": "$ 4.30",
							"wrap": true
						}
					],
					"width": "auto"
				},
				{
					"type": "Column",
					"spacing": "small",
					"verticalContentAlignment": "center",
					"items": [
						{
							"type": "Image",
							"id": "chevronDown3",
							"url": "https://adaptivecards.io/content/down.png",
							"width": "20px",
							"altText": "Excess Baggage Cost $50.38 collapsed"
						},
						{
							"type": "Image",
							"id": "chevronUp3",
							"isVisible": false,
							"url": "https://adaptivecards.io/content/up.png",
							"width": "20px",
							"altText": "Excess Baggage Cost $50.38 expanded"
						}
					],
					"selectAction": {
						"type": "Action.ToggleVisibility",
						"targetElements": [
							"cardContent3",
							"chevronUp3",
							"chevronDown3"
						]
					},
					"width": "auto"
				}
			]
		},
		{
			"type": "Container",
			"id": "cardContent3",
			"isVisible": false,
			"items": [
				{
					"type": "Container",
					"items": [
						{
							"type": "Input.Text",
							"id": "comment3",
							"label": "Add your comment here"
						}
					]
				},
				{
					"type": "Container",
					"items": [
						{
							"type": "ColumnSet",
							"columns": [
								{
									"type": "Column",
									"items": [
										{
											"type": "ActionSet",
											"actions": [
												{
													"type": "Action.Submit",
													"title": "Send",
													"data": {
														"id": "_qkQW8dJlUeLVi7ZMEzYVw",
														"action": "comment",
														"lineItem": 3
													}
												}
											]
										}
									],
									"width": "auto"
								}
							]
						}
					]
				}
			]
		},
		{
			"type": "ColumnSet",
			"spacing": "large",
			"separator": true,
			"columns": [
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"text": "Total Expense Amount \t",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"text": "Non-reimbursable Amount",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"horizontalAlignment": "right",
							"text": "Advance Amount",
							"wrap": true
						}
					],
					"width": "stretch"
				},
				{
					"type": "Column",
					"items": [
						{
							"type": "TextBlock",
							"text": "404.30",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"text": "(-) 0.00 \t",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"text": "(-) 0.00 \t",
							"wrap": true
						}
					],
					"width": "auto"
				},
				{
					"type": "Column",
					"width": "auto"
				}
			]
		},
		{
			"type": "Container",
			"style": "emphasis",
			"items": [
				{
					"type": "ColumnSet",
					"columns": [
						{
							"type": "Column",
							"items": [
								{
									"type": "TextBlock",
									"horizontalAlignment": "right",
									"text": "Amount to be Reimbursed",
									"wrap": true
								}
							],
							"width": "stretch"
						},
						{
							"type": "Column",
							"items": [
								{
									"type": "TextBlock",
									"weight": "bolder",
									"text": "$ 404.30",
									"wrap": true
								}
							],
							"width": "auto"
						},
						{
							"type": "Column",
							"width": "auto"
						}
					]
				}
			],
			"bleed": true
		},
		{
			"type": "ColumnSet",
			"columns": [
				{
					"type": "Column",
					"selectAction": {
						"type": "Action.ToggleVisibility",
						"targetElements": [
							"cardContent4",
							"showHistory",
							"hideHistory"
						]
					},
					"verticalContentAlignment": "center",
					"items": [
						{
							"type": "TextBlock",
							"id": "showHistory",
							"horizontalAlignment": "right",
							"color": "accent",
							"text": "Show history",
							"wrap": true
						},
						{
							"type": "TextBlock",
							"id": "hideHistory",
							"isVisible": false,
							"horizontalAlignment": "right",
							"color": "accent",
							"text": "Hide history",
							"wrap": true
						}
					],
					"width": 1
				}
			]
		},
		{
			"type": "Container",
			"id": "cardContent4",
			"isVisible": false,
			"items": [
				{
					"type": "Container",
					"items": [
						{
							"type": "TextBlock",
							"text": "* Expense submitted by *Matt* on Wed, Apr 14th, 2019",
							"isSubtle": true,
							"wrap": true
						},
						{
							"type": "TextBlock",
							"text": "* Expense approved by *Thomas* on Thu, Apr 15th, 2019",
							"isSubtle": true,
							"wrap": true
						}
					]
				}
			]
		},
		{
			"type": "Container",
			"items": [
				{
					"type": "ActionSet",
					"actions": [
						{
							"type": "Action.Submit",
							"title": "Approve",
							"style": "positive",
							"data": {
								"id": "_qkQW8dJlUeLVi7ZMEzYVw",
								"action": "approve"
							}
						},
						{
							"type": "Action.ShowCard",
							"title": "Reject",
							"style": "destructive",
							"card": {
								"type": "AdaptiveCard",
								"body": [
									{
										"type": "Input.Text",
										"id": "RejectCommentID",
										"label": "Please specify an appropriate reason for rejection",
										"isRequired": true,
										"isMultiline": true,
										"errorMessage": "A reason for rejection is necessary"
									}
								],
								"actions": [
									{
										"type": "Action.Submit",
										"title": "Send",
										"data": {
											"id": "_qkQW8dJlUeLVi7ZMEzYVw",
											"action": "reject"
										}
									}
								]
							}
						}
					]
				}
			]
		}
	],
	"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
	"version": "1.2",
	"fallbackText": "This card requires Adaptive Cards v1.2 support to be rendered properly."
}

How Verified

Verified : Factset related Accessibility talkback and navigation for

Mobile device Android R ( with Webex) Android O Emulator(with Webex) Adaptive cards Visualizer)
Screen Recording 2022-05-13 at 3 49 00 PM Screen Recording 2022-05-13 at 4 02 07 PM Screen Recording 2022-05-13 at 4 08 34 PM
Microsoft Reviewers: Open in CodeFlow

@rankush
Copy link
Contributor Author

rankush commented May 15, 2022

Since the changes are approved .. Can it merged to main master ????

@rankush rankush requested a review from paulcam206 May 16, 2022 05:09
@paulcam206 paulcam206 merged commit a8d519a into microsoft:main May 19, 2022
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
…citly (microsoft#7452)

Co-authored-by: Rankush Kumar <rankkuma@cisco.com>
Co-authored-by: Paul Campbell <paulcam@microsoft.com>
rankush added a commit to rankush/AdaptiveCards that referenced this pull request May 8, 2024
…citly (microsoft#7452)

Co-authored-by: Rankush Kumar <rankkuma@cisco.com>
Co-authored-by: Paul Campbell <paulcam@microsoft.com>
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.

[Rendering] FactSet not focused by Accessibility ScreenReader
3 participants