Skip to content

[Shipping Labels] M4 accessibility layout issues #15783

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

Open
wants to merge 10 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down Expand Up @@ -70,7 +70,7 @@
<rect key="frame" x="0.0" y="92" width="288" height="0.0"/>
<color key="backgroundColor" name="Red50"/>
<constraints>
<constraint firstAttribute="height" priority="999" constant="34" id="1vO-Pa-Rrp"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="999" constant="34" id="1vO-Pa-Rrp"/>
</constraints>
<state key="normal" title="Add Customer Note"/>
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23727" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23721"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down Expand Up @@ -49,17 +49,11 @@
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8sO-TX-YXZ">
<rect key="frame" x="0.0" y="68" width="288" height="0.0"/>
<constraints>
<constraint firstAttribute="height" priority="999" constant="38" id="JD7-UH-chp"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="999" constant="38" id="JD7-UH-chp"/>
</constraints>
<state key="normal" title="Add Customer Note"/>
</button>
</subviews>
<constraints>
<constraint firstItem="KMy-GB-2vj" firstAttribute="leading" secondItem="3Ns-D0-Lmm" secondAttribute="leading" id="1sf-8Q-Erz"/>
<constraint firstItem="8sO-TX-YXZ" firstAttribute="leading" secondItem="3Ns-D0-Lmm" secondAttribute="leading" id="CXr-SC-scr"/>
<constraint firstAttribute="trailing" secondItem="8sO-TX-YXZ" secondAttribute="trailing" id="db6-Qe-0lI"/>
<constraint firstAttribute="trailing" secondItem="KMy-GB-2vj" secondAttribute="trailing" id="uSW-Ze-AEM"/>
</constraints>
</stackView>
</subviews>
<constraints>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct WooShippingCustomsRow: View {
@State private var showCustomsForm: Bool = false

var body: some View {
AdaptiveStack {
HStack {
Text(Localization.customsTitle)
.headlineStyle()
.foregroundColor(.primary)
Expand All @@ -22,7 +22,7 @@ struct WooShippingCustomsRow: View {
.captionStyle()
.padding(.horizontal, Layout.statusBadgeHorizontalPadding)
.padding(.vertical, Layout.statusBadgeVerticalPadding)
.frame(height: Layout.statusBadgeHeight * scale)
.frame(minHeight: Layout.statusBadgeHeight * scale)
.background(
RoundedRectangle(cornerRadius: Layout.statusBadgeCornerRadius)
.fill(informationIsCompleted ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct WooShippingHazmatRow: View {
Button(action: {
isShowingDetailView = true
}) {
AdaptiveStack {
HStack {
Text(Localization.hazmatLabel)
.bodyStyle()
Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct WooShippingAddPackageView: View {

@Environment(\.shippingWeightUnit) private var weightUnit
@Environment(\.shippingDimensionsUnit) private var dimensionsUnit
@Environment(\.dynamicTypeSize) private var dynamicTypeSize

init(selectedPackage: WooShippingPackageDataRepresentable? = nil,
addPackageAction: @escaping (WooShippingPackageDataRepresentable) -> Void) {
Expand All @@ -44,13 +45,7 @@ struct WooShippingAddPackageView: View {
var body: some View {
NavigationView {
VStack {
Picker("", selection: $packagesViewModel.selectedPackageType) {
ForEach(PackageProviderType.allCases, id: \.self) {
Text($0.name)
}
}
.pickerStyle(.segmented)
.padding()
packageTypeSelectorView
selectedPackageTypeView
}
.toolbar {
Expand All @@ -72,6 +67,27 @@ struct WooShippingAddPackageView: View {
.notice($packagesViewModel.notice)
}

// MARK: - Computed Properties

private var selectedPackageTypeIndex: Binding<Int> {
Binding(
get: {
PackageProviderType.allCases.firstIndex(of: packagesViewModel.selectedPackageType) ?? 0
},
set: { newIndex in
if let newType = PackageProviderType.allCases[safe: newIndex] {
packagesViewModel.selectedPackageType = newType
}
}
)
}

private var packageTypeTabs: [TopTabItem<EmptyView>] {
PackageProviderType.allCases.map { packageType in
TopTabItem(name: packageType.name, content: { EmptyView() })
}
}

// MARK: UI components

@ViewBuilder
Expand All @@ -94,6 +110,35 @@ struct WooShippingAddPackageView: View {
})
}
}

private var packageTypeSelectorView: some View {
Group {
if dynamicTypeSize.isAccessibilitySize {
TopTabView(
tabs: packageTypeTabs,
showContent: false,
selectedTabIndex: selectedPackageTypeIndex,
tabsContainerHorizontalPadding: nil,
selectedStateColor: .accentColor,
unselectedStateColor: .secondary,
selectedTabIndicatorHeight: 3.0,
tabPadding: 0,
tabsNameFont: .subheadline.bold(),
tabItemContentHorizontalPadding: 16.0,
tabItemContentVerticalPadding: 9.0
)
.padding(.vertical)
} else {
Picker("", selection: $packagesViewModel.selectedPackageType) {
ForEach(PackageProviderType.allCases, id: \.self) {
Text($0.name)
}
}
.pickerStyle(.segmented)
.padding()
}
}
}
}

struct WooShippingAddPackageUnitInputView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ private extension WooShippingCreateLabelsView {
Image(systemName: isVerified ? "checkmark.circle" : "exclamationmark.circle")
Text(label)
.frame(maxWidth: .infinity, alignment: .leading)
.fixedSize(horizontal: false, vertical: true)
Button(action: onDismiss) {
Image(systemName: "xmark")
.renderedIf(!isVerified)
Expand Down