mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Accessibility UI fixes (#1685)
* Fix accessibiliity in room attachment picker * Fix FormattingToolbar accessibility * Cleanup * Fix ui tests
This commit is contained in:
parent
27408fe818
commit
dc5514bc0b
@ -17,7 +17,11 @@
|
||||
import SwiftUI
|
||||
|
||||
struct FixedIconSizeLabelStyle: LabelStyle {
|
||||
@ScaledMetric private var iconSize = 24.0
|
||||
@ScaledMetric private var iconSize: CGFloat
|
||||
|
||||
init(iconSize: Double = 24.0) {
|
||||
_iconSize = .init(wrappedValue: iconSize)
|
||||
}
|
||||
|
||||
var spacing: CGFloat = 16
|
||||
|
||||
|
@ -54,24 +54,29 @@ struct ComposerToolbar: View {
|
||||
}
|
||||
|
||||
private var bottomBar: some View {
|
||||
HStack(alignment: .bottom, spacing: 10) {
|
||||
Button {
|
||||
context.composerActionsEnabled = false
|
||||
context.composerExpanded = false
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.font(.compound.headingLG)
|
||||
.foregroundColor(.compound.textActionPrimary)
|
||||
}
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomScreen.composerToolbar.closeFormattingOptions)
|
||||
.padding(.bottom, 5) // centre align with the send button
|
||||
HStack(alignment: .center, spacing: 10) {
|
||||
closeRTEButton
|
||||
|
||||
FormattingToolbar(formatItems: context.formatItems) { action in
|
||||
context.send(viewAction: .composerAction(action: action.composerAction))
|
||||
}
|
||||
|
||||
sendButton
|
||||
}
|
||||
}
|
||||
|
||||
private var closeRTEButton: some View {
|
||||
Button {
|
||||
context.composerActionsEnabled = false
|
||||
context.composerExpanded = false
|
||||
} label: {
|
||||
Image(systemName: "xmark.circle.fill")
|
||||
.font(.compound.headingLG)
|
||||
.foregroundColor(.compound.textActionPrimary)
|
||||
}
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomScreen.composerToolbar.closeFormattingOptions)
|
||||
}
|
||||
|
||||
private var sendButton: some View {
|
||||
Button {
|
||||
context.send(viewAction: .sendMessage)
|
||||
|
@ -22,6 +22,8 @@ struct FormattingToolbar: View {
|
||||
/// The action when an item is selected
|
||||
var formatAction: (FormatType) -> Void
|
||||
|
||||
@ScaledMetric private var toolbarButtonIconSize = 24
|
||||
|
||||
var body: some View {
|
||||
ScrollView(.horizontal) {
|
||||
HStack(spacing: 4) {
|
||||
@ -31,10 +33,13 @@ struct FormattingToolbar: View {
|
||||
} label: {
|
||||
item.icon
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(width: toolbarButtonIconSize, height: toolbarButtonIconSize)
|
||||
.foregroundColor(item.foregroundColor)
|
||||
.padding(10)
|
||||
}
|
||||
.disabled(item.state == .disabled)
|
||||
.frame(width: 44, height: 44)
|
||||
.background(item.backgroundColor)
|
||||
.cornerRadius(8)
|
||||
.accessibilityIdentifier(item.accessibilityIdentifier)
|
||||
|
@ -115,8 +115,10 @@ struct RoomAttachmentPicker: View {
|
||||
Text(title)
|
||||
} icon: {
|
||||
icon
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
}
|
||||
.labelStyle(FixedIconSizeLabelStyle())
|
||||
.labelStyle(FixedIconSizeLabelStyle(iconSize: 20))
|
||||
.multilineTextAlignment(.leading)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(16)
|
||||
|
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.userSessionScreenRTE-1.png
(Stored with Git LFS)
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.userSessionScreenRTE-1.png
(Stored with Git LFS)
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.userSessionScreenRTE-2.png
(Stored with Git LFS)
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPad-9th-generation.userSessionScreenRTE-2.png
(Stored with Git LFS)
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.userSessionScreenRTE-1.png
(Stored with Git LFS)
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.userSessionScreenRTE-1.png
(Stored with Git LFS)
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.userSessionScreenRTE-2.png
(Stored with Git LFS)
BIN
UITests/Sources/__Snapshots__/Application/en-GB-iPhone-14.userSessionScreenRTE-2.png
(Stored with Git LFS)
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.userSessionScreenRTE-1.png
(Stored with Git LFS)
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.userSessionScreenRTE-1.png
(Stored with Git LFS)
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.userSessionScreenRTE-2.png
(Stored with Git LFS)
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPad-9th-generation.userSessionScreenRTE-2.png
(Stored with Git LFS)
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.userSessionScreenRTE-1.png
(Stored with Git LFS)
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.userSessionScreenRTE-1.png
(Stored with Git LFS)
Binary file not shown.
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.userSessionScreenRTE-2.png
(Stored with Git LFS)
BIN
UITests/Sources/__Snapshots__/Application/pseudo-iPhone-14.userSessionScreenRTE-2.png
(Stored with Git LFS)
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user