Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

VoiceOver accessibility #1496

Merged
merged 6 commits into from
Apr 25, 2016
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
1 change: 1 addition & 0 deletions platform/ios/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CON
- The user dot now moves smoothly between user location updates while user location tracking is disabled. ([#1582](https://github.com/mapbox/mapbox-gl-native/pull/1582))
- An MGLAnnotation can be relocated by changing its `coordinate` property in a KVO-compliant way. An MGLMultiPoint cannot be relocated. ([#3835](https://github.com/mapbox/mapbox-gl-native/pull/3835))
- Setting the `image` property of an MGLAnnotationImage to `nil` resets it to the default red pin image and reclaims resources that can be used to customize additional annotations. ([#3835](https://github.com/mapbox/mapbox-gl-native/pull/3835))
- The compass, user dot, and visible annotations are now accessible to VoiceOver users. ([#1496](https://github.com/mapbox/mapbox-gl-native/pull/1496))
- The SDK is now localizable. No localizations are currently provided, other than English, but if you need a particular localization, you can install the SDK manually and drop a .lproj folder into the framework. ([#4783](https://github.com/mapbox/mapbox-gl-native/pull/4783))
- Fixed an issue preventing KVO change notifications from being generated on MGLMapView’s `userTrackingMode` key path when `-setUserTrackingMode:animated:` is called. ([#4724](https://github.com/mapbox/mapbox-gl-native/pull/4724))
- Rendering now occurs on the main thread, fixing a hang when calling `-[MGLMapView styleURL]` before the map view has fully loaded or while the application is in the background. ([#2909](https://github.com/mapbox/mapbox-gl-native/pull/2909))
Expand Down
5 changes: 5 additions & 0 deletions platform/ios/app/MBXCustomCalloutView.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ - (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToV
CGFloat frameOriginY = rect.origin.y - frameHeight;
self.frame = CGRectMake(frameOriginX, frameOriginY,
frameWidth, frameHeight);

if ([self.delegate respondsToSelector:@selector(calloutViewDidAppear:)])
{
[self.delegate performSelector:@selector(calloutViewDidAppear:) withObject:self];
}
}

- (void)dismissCalloutAnimated:(BOOL)animated
Expand Down
26 changes: 25 additions & 1 deletion platform/ios/app/MBXViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -518,24 +518,30 @@ - (IBAction)cycleStyles:(__unused id)sender
[titleButton setTitle:styleNames[self.styleIndex] forState:UIControlStateNormal];
}

- (IBAction)locateUser:(__unused id)sender
- (IBAction)locateUser:(id)sender
{
MGLUserTrackingMode nextMode;
NSString *nextAccessibilityValue;
switch (self.mapView.userTrackingMode) {
case MGLUserTrackingModeNone:
nextMode = MGLUserTrackingModeFollow;
nextAccessibilityValue = @"Follow location";
break;
case MGLUserTrackingModeFollow:
nextMode = MGLUserTrackingModeFollowWithHeading;
nextAccessibilityValue = @"Follow location and heading";
break;
case MGLUserTrackingModeFollowWithHeading:
nextMode = MGLUserTrackingModeFollowWithCourse;
nextAccessibilityValue = @"Follow course";
break;
case MGLUserTrackingModeFollowWithCourse:
nextMode = MGLUserTrackingModeNone;
nextAccessibilityValue = @"Off";
break;
}
self.mapView.userTrackingMode = nextMode;
[sender setAccessibilityValue:nextAccessibilityValue];
}

- (IBAction)startWorldTour:(__unused id)sender
Expand Down Expand Up @@ -739,6 +745,24 @@ - (void)mapView:(__unused MGLMapView *)mapView didChangeUserTrackingMode:(MGLUse
return nil;
}

- (UIView *)mapView:(__unused MGLMapView *)mapView leftCalloutAccessoryViewForAnnotation:(__unused id<MGLAnnotation>)annotation
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectZero;
[button setTitle:@"Left" forState:UIControlStateNormal];
[button sizeToFit];
return button;
}

- (UIView *)mapView:(__unused MGLMapView *)mapView rightCalloutAccessoryViewForAnnotation:(__unused id<MGLAnnotation>)annotation
{
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
button.frame = CGRectZero;
[button setTitle:@"Right" forState:UIControlStateNormal];
[button sizeToFit];
return button;
}

- (void)mapView:(MGLMapView *)mapView tapOnCalloutForAnnotation:(id <MGLAnnotation>)annotation
{
if ( ! [annotation isKindOfClass:[MGLPointAnnotation class]])
Expand Down
15 changes: 12 additions & 3 deletions platform/ios/app/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
</view>
<navigationItem key="navigationItem" id="p8W-eP-el5">
<nil key="title"/>
<barButtonItem key="leftBarButtonItem" image="settings.png" id="Jw8-JP-CaZ">
<barButtonItem key="leftBarButtonItem" image="settings.png" id="Jw8-JP-CaZ" userLabel="Map Settings">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accessibilityLabel" value="Map settings"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="showSettings:" destination="WaX-pd-UZQ" id="X2C-Ee-Qvt"/>
</connections>
Expand All @@ -53,12 +56,18 @@
</connections>
</button>
<rightBarButtonItems>
<barButtonItem image="TrackingLocationOffMask.png" id="CQ1-GP-M6x">
<barButtonItem image="TrackingLocationOffMask.png" id="CQ1-GP-M6x" userLabel="User Tracking Mode">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accessibilityLabel" value="User tracking mode"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="locateUser:" destination="WaX-pd-UZQ" id="XgF-DB-z3f"/>
</connections>
</barButtonItem>
<barButtonItem systemItem="organize" id="5IK-vz-jKQ">
<barButtonItem systemItem="organize" id="5IK-vz-jKQ" userLabel="Offline Packs">
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="accessibilityLabel" value="Offline packs"/>
</userDefinedRuntimeAttributes>
<connections>
<segue destination="7q0-lI-zqb" kind="show" identifier="ShowOfflinePacks" id="xjx-0t-0LD"/>
</connections>
Expand Down
14 changes: 10 additions & 4 deletions platform/ios/resources/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Accessibility hint */
"ANNOTATION_A11Y_HINT" = "Shows more info";

/* No comment provided by engineer. */
"API_CLIENT_400_DESC" = "The session data task failed. Original request was: %@";

Expand All @@ -7,6 +10,9 @@
/* No comment provided by engineer. */
"CANCEL" = "Cancel";

/* Accessibility hint */
"COMPASS_A11Y_HINT" = "Rotates the map to face due north";

/* Accessibility label */
"COMPASS_A11Y_LABEL" = "Compass";

Expand All @@ -25,8 +31,11 @@
/* Setup documentation URL display string; keep as short as possible */
"FIRST_STEPS_URL" = "mapbox.com/help/first-steps-ios-sdk";

/* Accessibility hint */
"INFO_A11Y_HINT" = "Shows credits, a feedback form, and more";

/* Accessibility label */
"INFO_A11Y_LABEL" = "Attribution info";
"INFO_A11Y_LABEL" = "About this map";

/* Accessibility label */
"LOGO_A11Y_LABEL" = "Mapbox logo";
Expand Down Expand Up @@ -67,9 +76,6 @@
/* Telemetry prompt title */
"TELEMETRY_TITLE" = "Make Mapbox Maps Better";

/* Accessibility label */
"USER_DOT_A11Y_LABEL" = "User location";

/* Default user location annotation title */
"USER_DOT_TITLE" = "You Are Here";

7 changes: 6 additions & 1 deletion platform/ios/src/MGLCalloutView.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)calloutViewWillAppear:(UIView<MGLCalloutView> *)calloutView;

/**
Called after the callout view appears on screen, or after the appearance animation is complete.
*/
- (void)calloutViewDidAppear:(UIView<MGLCalloutView> *)calloutView;

@end

NS_ASSUME_NONNULL_END
NS_ASSUME_NONNULL_END
Loading