mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-11 13:59:13 +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
|
import SwiftUI
|
||||||
|
|
||||||
struct FixedIconSizeLabelStyle: LabelStyle {
|
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
|
var spacing: CGFloat = 16
|
||||||
|
|
||||||
|
@ -54,24 +54,29 @@ struct ComposerToolbar: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var bottomBar: some View {
|
private var bottomBar: some View {
|
||||||
HStack(alignment: .bottom, spacing: 10) {
|
HStack(alignment: .center, spacing: 10) {
|
||||||
Button {
|
closeRTEButton
|
||||||
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
|
|
||||||
FormattingToolbar(formatItems: context.formatItems) { action in
|
FormattingToolbar(formatItems: context.formatItems) { action in
|
||||||
context.send(viewAction: .composerAction(action: action.composerAction))
|
context.send(viewAction: .composerAction(action: action.composerAction))
|
||||||
}
|
}
|
||||||
|
|
||||||
sendButton
|
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 {
|
private var sendButton: some View {
|
||||||
Button {
|
Button {
|
||||||
context.send(viewAction: .sendMessage)
|
context.send(viewAction: .sendMessage)
|
||||||
|
@ -22,6 +22,8 @@ struct FormattingToolbar: View {
|
|||||||
/// The action when an item is selected
|
/// The action when an item is selected
|
||||||
var formatAction: (FormatType) -> Void
|
var formatAction: (FormatType) -> Void
|
||||||
|
|
||||||
|
@ScaledMetric private var toolbarButtonIconSize = 24
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView(.horizontal) {
|
ScrollView(.horizontal) {
|
||||||
HStack(spacing: 4) {
|
HStack(spacing: 4) {
|
||||||
@ -31,10 +33,13 @@ struct FormattingToolbar: View {
|
|||||||
} label: {
|
} label: {
|
||||||
item.icon
|
item.icon
|
||||||
.renderingMode(.template)
|
.renderingMode(.template)
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
|
.frame(width: toolbarButtonIconSize, height: toolbarButtonIconSize)
|
||||||
.foregroundColor(item.foregroundColor)
|
.foregroundColor(item.foregroundColor)
|
||||||
|
.padding(10)
|
||||||
}
|
}
|
||||||
.disabled(item.state == .disabled)
|
.disabled(item.state == .disabled)
|
||||||
.frame(width: 44, height: 44)
|
|
||||||
.background(item.backgroundColor)
|
.background(item.backgroundColor)
|
||||||
.cornerRadius(8)
|
.cornerRadius(8)
|
||||||
.accessibilityIdentifier(item.accessibilityIdentifier)
|
.accessibilityIdentifier(item.accessibilityIdentifier)
|
||||||
|
@ -115,8 +115,10 @@ struct RoomAttachmentPicker: View {
|
|||||||
Text(title)
|
Text(title)
|
||||||
} icon: {
|
} icon: {
|
||||||
icon
|
icon
|
||||||
|
.resizable()
|
||||||
|
.scaledToFit()
|
||||||
}
|
}
|
||||||
.labelStyle(FixedIconSizeLabelStyle())
|
.labelStyle(FixedIconSizeLabelStyle(iconSize: 20))
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
.padding(16)
|
.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