Skip to content

Commit

Permalink
fix: πŸ› [BCP:2370082757] Fix SignatureCaptureView VO issues (#602)
Browse files Browse the repository at this point in the history
βœ… Closes: 2370082757
  • Loading branch information
janhuachu committed Oct 16, 2023
1 parent 44de9bd commit 6d09d0f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ struct SignatureCaptureViewExample2: View {
let tapAction = Action(model: _TapToSignActionDefault())
var body: some View {
SignatureCaptureView(title: "Long Long Long Long Long Long Long Signature",
startAction: tapAction,
startAction: startAction,
restartAction: restartAction,
cancelAction: Action(actionText: "Cancel2"),
clearAction: Action(actionText: "ClearClear"),
saveAction: Action(actionText: "Save Image"),
Expand Down
3 changes: 3 additions & 0 deletions Sources/FioriSwiftUICore/Views/Action+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ extension Action: View {
} label: {
Text(self._actionText ?? "")
}
.accessibilityElement()
.accessibilityLabel(_actionText ?? "")
.accessibilityAddTraits(.isButton)
} else {
EmptyView()
}
Expand Down
19 changes: 14 additions & 5 deletions Sources/FioriSwiftUICore/Views/SignatureCaptureView+View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extension SignatureCaptureView: View {
.padding(.bottom, 11)
Spacer()
cancelAction
.accessibilitySimultaneousGesture(
.simultaneousGesture(
TapGesture()
.onEnded { _ in
clear()
Expand Down Expand Up @@ -123,6 +123,8 @@ extension SignatureCaptureView: View {
.frame(minHeight: _drawingViewMinHeight, maxHeight: imageMaxHeight())
.padding(.zero)
}.padding(.zero)
.accessibilityElement(children: .ignore)
.accessibilityLabel(NSLocalizedString("Signature Image", tableName: "FioriSwiftUICore", bundle: Bundle.accessor, comment: "Signature Image"))
} else {
drawingArea
.frame(minHeight: _drawingViewMinHeight, maxHeight: _drawingViewMaxHeight)
Expand All @@ -140,7 +142,7 @@ extension SignatureCaptureView: View {
if self.isEditing {
HStack {
clearAction
.accessibilitySimultaneousGesture(
.simultaneousGesture(
TapGesture()
.onEnded { _ in
clear()
Expand All @@ -150,7 +152,7 @@ extension SignatureCaptureView: View {
.frame(minWidth: 44, minHeight: 44)
Spacer()
saveAction
.accessibilitySimultaneousGesture(
.simultaneousGesture(
TapGesture()
.onEnded { _ in
isSaved = true
Expand All @@ -162,7 +164,7 @@ extension SignatureCaptureView: View {
.padding(.top, 8)
} else if (_signatureImage != nil && !isReenterTapped) || fullSignatureImage != nil {
restartAction
.accessibilitySimultaneousGesture(
.simultaneousGesture(
TapGesture()
.onEnded { _ in
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
Expand Down Expand Up @@ -192,6 +194,9 @@ extension SignatureCaptureView: View {
ZStack(alignment: .bottom) {
ScribbleView(image: $fullSignatureImage, currentDrawing: $currentDrawing, drawings: $drawings, isSaved: $isSaved, isEditing: $isEditing, onSave: self.onSave(_:), strokeWidth: strokeWidth, strokeColor: strokeColor, drawingViewBackgroundColor: drawingViewBackgroundColor, cropsImage: cropsImage, watermarkText: watermarkText, watermarkTextColor: watermarkTextColor, watermarkTextFont: watermarkTextFont, watermarkTextAlignment: watermarkTextAlignment, addsTimestampInImage: addsTimestampInImage, timestampFormatter: timestampFormatter)
.frame(maxWidth: .infinity, minHeight: 256, maxHeight: _drawingViewMaxHeight)
.accessibilityElement()
.accessibilityLabel(NSLocalizedString("Signature Area", tableName: "FioriSwiftUICore", bundle: Bundle.accessor, comment: "Signature Area"))
.accessibilityHint(NSLocalizedString("Double tap and drag to sign", tableName: "FioriSwiftUICore", bundle: Bundle.accessor, comment: "Double tap and drag to sign"))
HStack(alignment: .bottom) {
Image(systemName: "xmark")
.foregroundColor(xmarkColor)
Expand All @@ -202,14 +207,16 @@ extension SignatureCaptureView: View {
.frame(height: 1)
.setHidden(self.hidesSignatureLine)
}
.accessibilityElement(children: .ignore)
.accessibilityLabel(NSLocalizedString("Signature Line", tableName: "FioriSwiftUICore", bundle: Bundle.accessor, comment: "Signature Line"))
.padding([.leading, .trailing]).padding(.bottom, 48)
}
} else {
ZStack(alignment: .bottom) {
ZStack {
Color.preferredColor(.quaternaryFill).cornerRadius(10)
startAction
.accessibilitySimultaneousGesture(
.simultaneousGesture(
TapGesture()
.onEnded { _ in
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
Expand All @@ -230,6 +237,8 @@ extension SignatureCaptureView: View {
.frame(height: 1)
.setHidden(self.hidesSignatureLine)
}
.accessibilityElement(children: .ignore)
.accessibilityLabel(NSLocalizedString("Signature Line", tableName: "FioriSwiftUICore", bundle: Bundle.accessor, comment: "Signature Line"))
.padding([.leading, .trailing]).padding(.bottom, 48)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@
/* XBUT: Action available in inactive state of inline signature form cell, see https://experience.sap.com/fiori-design-ios/article/in-line-signature-form-cell/#behavior-and-interaction */
"Tap to Sign" = "Tap to Sign";

/* XACT: The accessibility label for the signature area */
"Signature Area" = "Signature Area";

/* XACT: The accessibility hint for the signature area */
"Double tap and drag to sign" = "Double tap and drag to sign";

/* XACT: The accessibility label for the signature image */
"Signature Image" = "Signature Image";

/* XACT: The accessibility label for the signature line */
"Signature Line" = "Signature Line";

/* XBUT: Action available in inactive state of inline signature form cell, see https://experience.sap.com/fiori-design-ios/article/in-line-signature-form-cell/#behavior-and-interaction */
"Canceled" = "Canceled";

Expand Down

0 comments on commit 6d09d0f

Please sign in to comment.