~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/old-fella

Old people's social media app

0
1

fix(accessibility): label images and composer controls

Merged geesawra.industries asked to merge into main from geesawra.industries/old-fella:fix/accessibility-audit
Sources/Oldsky/OldskyApp.swift+9−1
@@ -1739,6 +1739,7 @@ struct InlineImages: View {
url: url,
height: isReplyContext ? contextImageHeight : 260,
accessibilityLabel: "Attached image",
accessibilityDescription: descriptions[url],
tileIdentifier: "postImageTile-1",
onTap: { image in showImage(image, at: 0) }, requiresGIFReveal: requiresGIFReveal
)
@@ -1751,6 +1752,7 @@ struct InlineImages: View {
url: url,
height: isReplyContext ? contextImageHeight : 112,
accessibilityLabel: "Attached image \(index + 1) of \(displayedURLs.count)",
accessibilityDescription: descriptions[url],
tileIdentifier: "postImageTile-\(index + 1)",
onTap: { image in showImage(image, at: index) }, requiresGIFReveal: requiresGIFReveal
)
@@ -2450,6 +2452,7 @@ private struct RemoteInlineImage: View {
let url: URL
let height: CGFloat
let accessibilityLabel: String
var accessibilityDescription: String? = nil
let tileIdentifier: String
let onTap: ((UIImage?) -> Void)?
var limitsGIF = false
@@ -2477,6 +2480,7 @@ private struct RemoteInlineImage: View {
.buttonStyle(.plain)
.accessibilityElement(children: .ignore)
.accessibilityLabel(accessibilityLabel)
.accessibilityValue(accessibilityDescription?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "")
.accessibilityHint("Opens image viewer")
.accessibilityIdentifier(tileIdentifier)
} else if let image {
@@ -3214,6 +3218,7 @@ struct ComposeView: View {
.frame(minHeight: 140)
.scrollContentBackground(.hidden)
.focused($textIsFocused)
.accessibilityLabel("Post text")
.accessibilityIdentifier("composeTextField")
.disabled(model.isPublishing)
.overlay(alignment: .topLeading) {
@@ -3223,6 +3228,7 @@ struct ComposeView: View {
.padding(.top, 8)
.padding(.leading, 5)
.allowsHitTesting(false)
.accessibilityHidden(true)
}
}
}
@@ -3351,6 +3357,7 @@ struct ComposeView: View {
.scaledToFill()
.frame(width: 132, height: 132)
.clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous))
.accessibilityHidden(true)
.overlay(alignment: .topTrailing) {
Button {
attachments.remove(at: index)
@@ -3361,9 +3368,10 @@ struct ComposeView: View {
.foregroundStyle(.white, .black.opacity(0.65))
}
.padding(6)
.accessibilityLabel("Remove image")
.accessibilityLabel("Remove image \(index + 1)")
}
TextField("Add alt text", text: altTextBinding(for: attachment.id))
.accessibilityLabel("Alt text for image \(index + 1)")
.font(.footnote)
.textFieldStyle(.roundedBorder)
.frame(width: 132)
Tests/OldskyUITests/OldskyUITests.swift+19−1
@@ -1,6 +1,21 @@
import XCTest
final class OldskyUITests: XCTestCase {
func testComposerAccessibilityLabels() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-compose-images"]
app.launch()
XCTAssertTrue(app.buttons["postText-post-1"].waitForExistence(timeout: 10))
app.tabBars.buttons["New post"].tap()
let editor = app.textViews["composeTextField"]
XCTAssertTrue(editor.waitForExistence(timeout: 5))
XCTAssertEqual(editor.label, "Post text")
XCTAssertTrue(app.textFields["Alt text for image 1"].exists)
XCTAssertTrue(app.textFields["Alt text for image 2"].exists)
XCTAssertTrue(app.buttons["Remove image 1"].exists)
XCTAssertTrue(app.buttons["Remove image 2"].exists)
}
func testPostShareActionsInFeedAndDetail() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-share"]
@@ -1141,7 +1156,10 @@ final class OldskyUITests: XCTestCase {
app.launch()
let grid = app.cells.containing(.button, identifier: "postText-post-1").firstMatch.descendants(matching: .any)["postImageGrid"].firstMatch
XCTAssertTrue(grid.waitForExistence(timeout: 5))
grid.images["Attached image"].firstMatch.tap()
let tile = grid.descendants(matching: .any)["postImageTile-1"].firstMatch
XCTAssertTrue(tile.waitForExistence(timeout: 5))
XCTAssertEqual(tile.value as? String, "A blue square.")
tile.tap()
let image = app.descendants(matching: .any)["imageViewerImage"].firstMatch
XCTAssertTrue(image.waitForExistence(timeout: 5))
image.tap()
ACCESSIBILITY.mdnew+17−0
@@ -0,0 +1,17 @@
# Accessibility checks
The automated UI tests cover the composer labels and an inline image description. They do not test spoken output, text clipping, or contrast.
## Manual checks
Use an iPhone or simulator with a signed-in account and posts that include links, images, and replies. Repeat the checks in light and dark appearance. Repeat the reading and composer checks at the largest accessibility text size.
1. Open Following, a profile, and a post with replies. Make sure that text and controls remain readable and reachable.
2. Turn on VoiceOver. Move through each screen and open a post, profile, link, and reply.
3. Make sure that VoiceOver reads image descriptions and identifies images without descriptions. Open and close the image viewer.
4. Create a post and a reply. Add multiple images, edit each description, and remove an image. Make sure that VoiceOver identifies each control.
5. Inspect text, icons, and focus indicators against their backgrounds in both appearances. Use a contrast measurement tool for a conformance assessment.
## Limits
These checks require human review. Automated UI tests do not establish VoiceOver usability, contrast compliance, or support at every text size. Image descriptions depend on the text supplied by the author. Post action labels do not currently announce like or repost counts. The composer layout and fixed-size attachment fields still need review at the largest text sizes.