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

fix: 🐛 [BCP:2370082757] Fix SignatureCaptureView VO issues #602

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this modifier needed?

Copy link
Contributor Author

@janhuachu janhuachu Oct 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is needed. Without this line, the VO announcement is fine but double tap will not trigger action. Strange.

.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
@@ -1,24 +1,36 @@
/* XMSG: Placeholder text in chart when there is no data */
"No Data" = "No Data";

Check warning on line 2 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "No Data" is unused (unused)

/* XBUT: Save action in inline signature form cell, see https://experience.sap.com/fiori-design-ios/article/in-line-signature-form-cell/#behavior-and-interaction */
"Save" = "Save";

Check warning on line 5 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "Save" is unused (unused)

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

Check warning on line 8 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "Re-enter Signature" is unused (unused)

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

Check warning on line 11 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "Clear" is unused (unused)

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

Check warning on line 14 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "Cancel" is unused (unused)

/* XTIT: Title of inline signature form cell, see https://experience.sap.com/fiori-design-ios/article/in-line-signature-form-cell/#behavior-and-interaction */
"Signature" = "Signature";

Check warning on line 17 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "Signature" is unused (unused)

/* 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";

Check warning on line 20 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "Tap to Sign" is unused (unused)

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

Check warning on line 23 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "Signature Area" is unused (unused)

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

Check warning on line 26 in Sources/FioriSwiftUICore/_localization/en.lproj/FioriSwiftUICore.strings

View workflow job for this annotation

GitHub Actions / LocalizableTextCommentsCheck

Unused Violation: Localized string "Double tap and drag to sign" is unused (unused)

/* 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
Loading