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

Accessibility stage 1 #1025

Merged
merged 65 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 60 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
c1d2962
Update copyright, add CMPAccessibilityScrollView
elijah-semyonov Dec 14, 2023
0a150aa
Rewire ScrollView accessibility implementation
elijah-semyonov Dec 14, 2023
9c32cb8
Avoid edge case where impl could be changed after the object is logic…
elijah-semyonov Dec 14, 2023
1125119
Add scrolling logic stubs
elijah-semyonov Dec 14, 2023
6c6cf0a
Add @ExportoOjc for name resolution in debugger
elijah-semyonov Dec 15, 2023
3729153
Print debug data on focus
elijah-semyonov Dec 15, 2023
49e669b
Fix crash
elijah-semyonov Dec 15, 2023
1164c62
Add logic for scrolling.
elijah-semyonov Dec 15, 2023
868d512
Add TODOs
elijah-semyonov Dec 15, 2023
5b12a6d
Add TODO
elijah-semyonov Dec 15, 2023
1fcef2a
Fix
elijah-semyonov Dec 15, 2023
e5de324
Add TODOs, remove dead code
elijah-semyonov Dec 15, 2023
8959b17
Add testTag and recursive scroll call
elijah-semyonov Dec 18, 2023
e8b601e
Fix scrolling
elijah-semyonov Dec 18, 2023
599e68c
Remove indirect implementation.
elijah-semyonov Dec 18, 2023
7dcf650
Add EditableText to label
elijah-semyonov Dec 19, 2023
e572daf
Add more debug logs.
elijah-semyonov Dec 19, 2023
9d89068
Add more debug logs.
elijah-semyonov Dec 19, 2023
0f40513
Post layout change notification when synced something.
elijah-semyonov Dec 19, 2023
364a0df
Add todo for crash.
elijah-semyonov Dec 19, 2023
d257c17
Minor changes
elijah-semyonov Dec 20, 2023
937ecaf
Enrich logging
elijah-semyonov Dec 20, 2023
712a7b6
Add scroll to visible element on focus change
elijah-semyonov Dec 20, 2023
a90575f
Add arbitary scale to avoid overscrolling
elijah-semyonov Dec 20, 2023
0c6f2c1
Fix scrollTo logic a bit
elijah-semyonov Dec 20, 2023
9312951
Fix scrollTo logic a bit
elijah-semyonov Dec 20, 2023
f651d43
Add TODO
elijah-semyonov Dec 20, 2023
47ece12
Add TODO
elijah-semyonov Jan 9, 2024
2dea87e
Avoid creating a new semantics node every time its id is asked
elijah-semyonov Jan 9, 2024
768448c
Add possibility to refocus a11y from dead elements
elijah-semyonov Jan 9, 2024
afd3d83
Eagerly recompute semantics tree on render
elijah-semyonov Jan 10, 2024
b617f2e
Revert "Eagerly recompute semantics tree on render"
elijah-semyonov Jan 10, 2024
e16af45
Cherry pick minor refactoring from reverted commit
elijah-semyonov Jan 10, 2024
cc89a29
Revert "Prevent unattached nodes from making it into the semantics tree"
elijah-semyonov Jan 11, 2024
3dc016d
Remove unrelevant todo
elijah-semyonov Jan 11, 2024
a7e4eed
Add config option to force accessibility sync
elijah-semyonov Jan 11, 2024
81faf63
Integrate new strategy with some debug prints.
elijah-semyonov Jan 11, 2024
a763f9c
Add debug log
elijah-semyonov Jan 12, 2024
a8f9f8c
Remove ghost semantic nodes.
elijah-semyonov Jan 18, 2024
1c1a707
Comment out error for now
elijah-semyonov Jan 22, 2024
0b3b0f1
Fix compilation error and `accessibilityActivate` crash
elijah-semyonov Jan 24, 2024
9f5dc1f
Resolve label on the fly
elijah-semyonov Jan 26, 2024
d8ddae7
Resolve isAccessible dynamically
elijah-semyonov Jan 26, 2024
44bb9b7
Modify isAccessibilityElement logic
elijah-semyonov Jan 26, 2024
bd63d31
Ignore IsTraversalGroup for accessibility focus
elijah-semyonov Jan 26, 2024
4a50229
Modify accessibility logic
elijah-semyonov Jan 26, 2024
fbc81f9
Compute UITraits lazily
elijah-semyonov Jan 26, 2024
8b4a809
Modify label computation logic
elijah-semyonov Jan 26, 2024
9b70ebb
Move more computed properties to lazy
elijah-semyonov Jan 26, 2024
b056e08
Make all a11y properties computed
elijah-semyonov Jan 26, 2024
0c57f01
Add todo
elijah-semyonov Jan 26, 2024
88c9217
Update API
elijah-semyonov Jan 30, 2024
c1985a7
Fix unconditional log
elijah-semyonov Jan 30, 2024
8013201
Mark experimental API
elijah-semyonov Jan 30, 2024
8634379
OptIn and remove feature flag.
elijah-semyonov Jan 30, 2024
f6409e6
Fix invalid cardinality
elijah-semyonov Jan 30, 2024
2c511c1
Revert cherrypick
elijah-semyonov Jan 30, 2024
99274b8
Merge branch 'jb-main' into es/accessibility-stage-1
elijah-semyonov Jan 31, 2024
e8cc3c3
Remove redundant TODO
elijah-semyonov Jan 31, 2024
87da0d3
Merge branch 'jb-main' into es/accessibility-stage-1
elijah-semyonov Jan 31, 2024
592cd1e
Remove extra return.
elijah-semyonov Feb 2, 2024
816c358
Add review-based changes
elijah-semyonov Feb 2, 2024
6a9f2e7
Remove println
elijah-semyonov Feb 2, 2024
caca45a
Add debug logger to demo app
elijah-semyonov Feb 2, 2024
0efb15d
Fix scrolling bug
elijah-semyonov Feb 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.mpp.demo.bug.BugReproducers
import androidx.compose.mpp.demo.components.Components
Expand Down Expand Up @@ -150,7 +151,7 @@ class App(
},
navigationIcon = {
Icon(
Icons.Filled.ArrowBack,
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = "Back",
modifier = Modifier.backButton()
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project

Choose a reason for hiding this comment

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

Now we can update to 2024

Copy link
Author

Choose a reason for hiding this comment

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

No, @MatkovIvan said that Google stated that those indicate the file creation date and not the current one

*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,27 @@ NS_ASSUME_NONNULL_BEGIN
// Redeclared to make it visible to Kotlin for override purposes, workaround for the following issue:
// https://youtrack.jetbrains.com/issue/KT-56001/Kotlin-Native-import-Objective-C-category-members-as-class-members-if-the-category-is-located-in-the-same-file

-(BOOL)accessibilityActivate CMP_MUST_BE_OVERRIDED;
- (NSArray<UIAccessibilityCustomAction *> *)accessibilityCustomActions CMP_MUST_BE_OVERRIDED;

- (UIAccessibilityTraits)accessibilityTraits CMP_MUST_BE_OVERRIDED;

- (NSString *__nullable)accessibilityIdentifier CMP_MUST_BE_OVERRIDED;

- (NSString *__nullable)accessibilityHint CMP_MUST_BE_OVERRIDED;

- (NSString *__nullable)accessibilityLabel CMP_MUST_BE_OVERRIDED;

- (NSString *__nullable)accessibilityValue CMP_MUST_BE_OVERRIDED;

- (CGRect)accessibilityFrame CMP_MUST_BE_OVERRIDED;

- (BOOL)isAccessibilityElement CMP_MUST_BE_OVERRIDED;

- (BOOL)accessibilityActivate CMP_MUST_BE_OVERRIDED;

- (void)accessibilityElementDidBecomeFocused;

- (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction CMP_MUST_BE_OVERRIDED;

@end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -43,7 +43,7 @@ - (void)setAccessibilityContainer:(__nullable id)accessibilityContainer {
// Overrides default accessibilityContainer implementation.
- (__nullable id)accessibilityContainer {
// see https://github.com/flutter/flutter/issues/87247
// TODO: investigate if this bug is still present on supported iOS versions, if it's not, fuse `accessibilityContainer` and `resolveAccessibilityContainer` implementations into a single one (like in `CMPAccessibilityContainer`)
// TODO: investigate if this bug is still present on iOS versions supported by Compose, if it's not, fuse `accessibilityContainer` and `resolveAccessibilityContainer` implementations into a single one (like in `CMPAccessibilityContainer`)
if (_inDealloc) {
return nil;
}
Expand All @@ -60,10 +60,50 @@ + (__nullable id)accessibilityContainerOfObject:(id)object {
return [object accessibilityContainer];
}

- (NSArray<UIAccessibilityCustomAction *> *)accessibilityCustomActions {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (UIAccessibilityTraits)accessibilityTraits {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (NSString *__nullable)accessibilityIdentifier {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (NSString *__nullable)accessibilityHint {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (NSString *__nullable)accessibilityLabel {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (NSString *__nullable)accessibilityValue {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (CGRect)accessibilityFrame {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (BOOL)isAccessibilityElement {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (BOOL)accessibilityActivate {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction {
CMP_MUST_BE_OVERRIDED_INVARIANT_VIOLATION
}

- (void)accessibilityElementDidBecomeFocused {
[super accessibilityElementDidBecomeFocused];
}

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -114,7 +114,7 @@ - (void)transitLifecycleToStarted {
- (void)scheduleHierarchyContainmentCheck {
double delayInSeconds = 0.5;

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
switch (self->_lifecycleState) {
case CMPViewControllerLifecycleStateInitalized:
case CMPViewControllerLifecycleStateDestroyed:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022 The Android Open Source Project
* Copyright 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down