Skip to content

Commit 1b9c55d

Browse files
Jwoo/ios a11y 2 (#8435)
* updated showcard to announce its state * fixed formatting --------- Co-authored-by: anna-dingler <[email protected]>
1 parent 81809d9 commit 1b9c55d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

source/ios/AdaptiveCards/ADCIOSVisualizer/ADCIOSVisualizer/ViewController.m

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
@interface ViewController () {
2828
id<ACRIBaseActionSetRenderer> _defaultRenderer;
2929
ACRChatWindow *_dataSource;
30+
__weak UIView *_targetView;
3031
dispatch_queue_t _global_queue;
3132
__weak AVPlayerViewController *_mediaViewController;
3233
}
@@ -212,7 +213,6 @@ - (void)viewDidLoad
212213

213214
ACOFeatureRegistration *featureReg = [ACOFeatureRegistration getInstance];
214215
[featureReg addFeature:@"acTest" featureVersion:@"1.0"];
215-
216216
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleVoiceOverEvent:) name:UIAccessibilityElementFocusedNotification object:nil];
217217
}
218218

@@ -281,7 +281,7 @@ - (void)didFetchUserResponses:(ACOAdaptiveCard *)card action:(ACOBaseActionEleme
281281
} else if (action.type == ACRToggleVisibility) {
282282
[self reloadRowsAtChatWindowsWithIndexPaths:self.chatWindow.indexPathsForSelectedRows];
283283
} else if (action.type == ACRShowCard) {
284-
[self reloadRowsAtChatWindowsWithIndexPaths:self.chatWindow.indexPathsForSelectedRows];
284+
[self reloadRowsAtChatWindowsWithIndexPaths:self.chatWindow.indexPathsForSelectedRows targetView:_targetView];
285285
}
286286
}
287287

@@ -313,6 +313,7 @@ - (void)didChangeViewLayout:(CGRect)oldFrame newFrame:(CGRect)newFrame propertie
313313

314314
- (void)didChangeVisibility:(UIButton *)button isVisible:(BOOL)isVisible
315315
{
316+
_targetView = button;
316317
if (isVisible) {
317318
button.backgroundColor = [UIColor redColor];
318319
} else {
@@ -665,6 +666,11 @@ - (void)reloadRowsAtChatWindowsWithIndexPathsAfterValidation:(NSArray<NSIndexPat
665666
}
666667

667668
- (void)reloadRowsAtChatWindowsWithIndexPaths:(NSArray<NSIndexPath *> *)indexPaths
669+
{
670+
[self reloadRowsAtChatWindowsWithIndexPaths:indexPaths targetView:nil];
671+
}
672+
673+
- (void)reloadRowsAtChatWindowsWithIndexPaths:(NSArray<NSIndexPath *> *)indexPaths targetView:(UIView *)targetView
668674
{
669675
dispatch_async(_global_queue,
670676
^{
@@ -687,7 +693,7 @@ - (void)reloadRowsAtChatWindowsWithIndexPaths:(NSArray<NSIndexPath *> *)indexPat
687693
[self.chatWindow reloadData];
688694
}
689695
completion:^(BOOL finished) {
690-
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, nil);
696+
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, targetView);
691697
}];
692698
}
693699
});

source/ios/AdaptiveCards/AdaptiveCards/AdaptiveCards/ACRShowCardTarget.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ - (IBAction)toggleVisibilityOfShowCard
126126
}
127127
_button.selected = !isSelected;
128128

129+
NSString *hint = hidden ? @"card expanded" : @"card collapsed";
130+
_button.accessibilityValue = NSLocalizedString(hint, nil);
131+
129132
if ([_rootView.acrActionDelegate respondsToSelector:@selector(didChangeVisibility:isVisible:)]) {
130133
[_rootView.acrActionDelegate didChangeVisibility:_button isVisible:(!_adcView.hidden)];
131134
}

0 commit comments

Comments
 (0)