Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@miquelbeltran
Copy link
Member

@miquelbeltran miquelbeltran commented Jan 9, 2020

Link to the design document: https://docs.google.com/document/d/1kePVlqWvJu5Ph0RL6wgg67F3SATmsJ8QY5N0S1MvaGg/edit?usp=sharing

Description

Read the "Increase Contrast" setting from iOS accessibility settings and pass it together with the rest of accessibility flags.

According to the Apple documentation, the method UIAccessibilityDarkerSystemColorsEnabled() exposes the value of the "Increase Contrast" setting in the Accessibility settings.

https://developer.apple.com/documentation/uikit/1615087-uiaccessibilitydarkersystemcolor

From UIInterface.h:

/* The value of the "high contrast" Accessibility setting is available via `UIAccessibilityDarkerSystemColorsEnabled()`,
 * and is also expressed as the UIAccessibilityContrast trait.
 */
typedef NS_ENUM(NSInteger, UIAccessibilityContrast) {
    UIAccessibilityContrastUnspecified = -1,
    UIAccessibilityContrastNormal,
    UIAccessibilityContrastHigh,
} API_AVAILABLE(ios(13.0), tvos(13.0)) API_UNAVAILABLE(watchos);

The good thing about UIAccessibilityDarkerSystemColorsEnabled is that it is available from iOS 8.0, and it is not exclusive of iOS 13 like the UIAccessibilityContrast trait.

The value is passed as a flag together with the rest of accessibility
settings.

Later on, the flag is exposed in the window.accessibilitySettings and can be read from the MediaQuery class in Flutter (a PR on the Flutter project will be done as well)

Related Issues

Reference ticket: flutter/flutter#48418

Blocks PR on flutter/flutter: flutter/flutter#48486

Tests

I couldn't find any equivalent test for any of the other platform specific accessibility flags.

I tested this locally with an iOS simulator.

@miquelbeltran
Copy link
Member Author

After reading #15370 I guess this is also considered a breaking change and needs to go through the process described here: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes

Probably means you will close this PR.

Nevertheless it was fun to try to fix it!

@Piinks
Copy link
Contributor

Piinks commented Jan 10, 2020

Hi @miquelbeltran! Welcome 🎉 and thanks for the contribution!
While this may be a breaking change, that does not necessarily mean it will be closed. I encourage you to read the breaking change policy you mentions, and consider if you would like to continue. There is a path to landing your change, just with some extra steps in this special case. :)

@miquelbeltran
Copy link
Member Author

Thanks @Piinks! I created the design document, added a link here and posted it on the #hackers-devrel channel, let's hope it all goes through :)

I will resolve the conflicts, since another accessibility flag has been reverted, to keep the change clean.

@miquelbeltran
Copy link
Member Author

The failing "analyze" is because a change also has to be made on the Flutter Framework repo.

Analyzing 3 directories...                                      

  error • Missing concrete implementation of 'getter AccessibilityFeatures.highContrast' • packages/flutter_test/test/window_test.dart:252:7 • non_abstract_class_inherits_abstract_member

Which requires to add the highContrast flag in the FakeAccessibilityFeatures test class.

@Piinks
Copy link
Contributor

Piinks commented Jan 13, 2020

I've left a note on the framework-side PR about splitting it into 2 smaller PRs. The first should unblock this one, and then you can land the other after this. I've also shared the design doc around to see if it can get more feedback.
If you haven't already, feel free to check out https://github.com/flutter/flutter/wiki/Chat and join in on the conversation! :)

@Piinks
Copy link
Contributor

Piinks commented Jan 13, 2020

Thanks @Piinks! I created the design document, added a link here and posted it on the #hackers-devrel channel, let's hope it all goes through :)

Oh! You are on the server. Sorry! I must have missed it. 😝

@LongCatIsLooong
Copy link
Contributor

Thank you for the pull request @miquelbeltran! Looks like https://github.com/flutter/engine/pull/10791/files is a different attempt at this andUIAccessibilityDarkerSystemColorsEnabled seems to be doing the same thing as UIAccessibilityContrast. Is there any official documentation that mentions the correspondence between the two?

@miquelbeltran
Copy link
Member Author

miquelbeltran commented Jan 15, 2020

Hi! It is explained in the PR description.

This is from the iOS UIKit Framework source code (UIInterface.h)

The value of the "high contrast" Accessibility setting is available via UIAccessibilityDarkerSystemColorsEnabled(),
and is also expressed as the UIAccessibilityContrast trait.

The UiAccessibilityContrast is iOS 13 only while UIAccessibilityDarkerSystemColorsEnabled exists from iOS 8.

There's more info on the description of this pr.

@miquelbeltran
Copy link
Member Author

I've updated the design document with a clarification on why using UIAccessibilityDarkerSystemColorsEnabled instead of UIAccessibilityContrast as well.

@Piinks
Copy link
Contributor

Piinks commented Jan 15, 2020

This is waiting on flutter/flutter#48486

@LongCatIsLooong
Copy link
Contributor

@miquelbeltran thanks for the explanation (and adding it to the doc)!
Is it possible to get different results from these two ways? I.e., UITraitCollection can be overridden by the parent view controller and since UIAccessibilityDarkerSystemColorsEnabled() reads from system settings it may not be aware of the override?

@miquelbeltran
Copy link
Member Author

@LongCatIsLooong you're welcome!

Is it possible to get different results from these two ways?

I think yes, as you say you can override the UITraitCollection. Seems that the UIAccessibilityContrast is the only one accessibility setting present in there.

I personally think that is UIAccessibilityDarkerSystemColorsEnabled the recommended way to go. Although maybe a mixed solution is to use UIAccessibilityDarkerSystemColorsEnabled on iOS 8 to 12, and use the UIAccessibilityContrast trait in iOS 13.

What do you think?

@LongCatIsLooong
Copy link
Contributor

I'm leaning towards handling it differently in iOS 13. I believe some work was already done in #10791 for iOS 13 high contrast, but accessibilityFeatures might be a more suitable channel to use (instead of settings).

@LongCatIsLooong
Copy link
Contributor

@miquelbeltran according to the wiki https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes, the design doc for the breaking change needs to be reviewed by dev rel folks in chat. Do you mind posting the design doc there?

@miquelbeltran
Copy link
Member Author

I did it a while ago

Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

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

Hi @miquelbeltran sorry for the delay! It looks like the changes are no longer considered breaking. Could you update flutter/flutter#48486?

@miquelbeltran
Copy link
Member Author

Thanks @LongCatIsLooong I've updated now the other PR with the requested changes. Let me know if something else is missing.

@LongCatIsLooong
Copy link
Contributor

Could you fix https://github.com/flutter/engine/pull/15343/checks?check_run_id=385448037 by following the steps in the error message? Not sure what's with the web engine build failure, seems unrelated. Maybe updating the branch will help?

Reference ticket: flutter/flutter#48418

According to the Apple documentation, the method
UIAccessibilityDarkerSystemColorsEnabled exposes the value of the
Increase Contrast setting in the Accessibility settings.

The value is passed as a flag together with the rest of accessibility
settings.

Add HighContrast index to web_ui

Add observer for the high contrast a11y setting change
@miquelbeltran
Copy link
Member Author

Thanks, I didn't see the formatting issue, fixed that and also rebased to current master.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 24, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 24, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 24, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 24, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 24, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 24, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 24, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 24, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 25, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 25, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 25, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 25, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 25, 2020
dnfield pushed a commit to flutter/flutter that referenced this pull request Feb 25, 2020
* 5b0cbbe Roll fuchsia/sdk/core/mac-amd64 from _jvYk... to WZgbp... (flutter/engine#16692)

* cbb0ff8 Roll src/third_party/skia c5ff41f2976e..7dfb46e7f397 (20 commits) (flutter/engine#16691)

* ab454ea Roll src/third_party/dart 0f141be8bd52..7469b87b042a (9 commits) (flutter/engine#16693)

* 1b73784 fix param (flutter/engine#16694)

* bdd2cf8 Roll src/third_party/skia 7dfb46e7f397..9baef3593c3c (3 commits) (flutter/engine#16696)

* 8f0bbfa Roll src/third_party/skia 9baef3593c3c..ed1ff23c2768 (5 commits) (flutter/engine#16699)

* f052d2e Roll fuchsia/sdk/core/linux-amd64 from VHyDa... to YPr0t... (flutter/engine#16701)

* 3fe3325 Roll src/third_party/dart 7469b87b042a..e187e42593e8 (11 commits) (flutter/engine#16702)

* f83092a Roll src/third_party/skia ed1ff23c2768..a5097354217b (1 commits) (flutter/engine#16703)

* 6b3d439 Roll src/third_party/skia a5097354217b..2c2db2762809 (1 commits) (flutter/engine#16704)

* fdabcad Enable lazy-async-stacks by-default in all modes (flutter/engine#16556)

* 02aa865 Fix the newline on some keyboards (flutter/engine#16560)

* cde7d47 Roll src/third_party/dart e187e42593e8..81d4cc6bc99a (3 commits) (flutter/engine#16705)

* 14a2b03 Roll fuchsia/sdk/core/mac-amd64 from WZgbp... to 78ZcV... (flutter/engine#16706)

* 7b0453e Roll src/third_party/skia 2c2db2762809..9d4e31d6cda5 (1 commits) (flutter/engine#16707)

* 5cef6d0 Roll fuchsia/sdk/core/linux-amd64 from YPr0t... to CZTpy... (flutter/engine#16708)

* 0ef67b5 opt out dart:ui from nnbd (flutter/engine#16473)

* bc4a27f [shell tests] Integrate Vulkan with Shell Tests (flutter/engine#16621)

* 2fdba52 Roll src/third_party/skia 9d4e31d6cda5..62076977a0b7 (11 commits) (flutter/engine#16710)

* 969cfc1 Roll src/third_party/skia 62076977a0b7..1d589a578ca4 (6 commits) (flutter/engine#16712)

* 8eb727e Flush the SkCanvas when submitting a frame in ShellTestPlatformViewVulkan::OffscreenSurface (flutter/engine#16717)

* e44f99b Roll src/third_party/skia 1d589a578ca4..706851dc99d9 (2 commits) (flutter/engine#16714)

* 60b27fd Reland "Remove usage of Dart_AllocateWithNativeFields" (flutter/engine#16713)

* 7a50e4d Roll src/third_party/dart 81d4cc6bc99a..fd20c7b92bb8 (31 commits) (flutter/engine#16716)

* 4aaafe0 Roll src/third_party/skia 706851dc99d9..df283d01cabb (3 commits) (flutter/engine#16719)

* e18aba3 Refactor of ClaimDartHandle -> AssociateWithDartWrapper (flutter/engine#16720)

* 66742b6 Roll src/third_party/skia df283d01cabb..3ffa7af75301 (1 commits) (flutter/engine#16722)

* e0303b0 Roll src/third_party/dart fd20c7b92bb8..6ef9131d82c4 (7 commits) (flutter/engine#16723)

* 0bd69f9 Roll src/third_party/skia 3ffa7af75301..77521d9e06e8 (2 commits) (flutter/engine#16725)

* 3e69286 Roll fuchsia/sdk/core/mac-amd64 from 78ZcV... to iYYAH... (flutter/engine#16726)

* 704396b Roll fuchsia/sdk/core/linux-amd64 from CZTpy... to -u-iU... (flutter/engine#16727)

* 645d4e6 Roll src/third_party/dart 6ef9131d82c4..5829fc7829d5 (3 commits) (flutter/engine#16728)

* b73dfed Roll src/third_party/skia 77521d9e06e8..392846665c40 (1 commits) (flutter/engine#16729)

* 2724727 Roll src/third_party/skia 392846665c40..bf5cb0f539e7 (1 commits) (flutter/engine#16730)

* ab0dd12 [web] Running safari tests on LUCI (flutter/engine#16715)

* e5091a8 Enable Vulkan-related shell unittests on Fuchsia (flutter/engine#16718)

* 930a80a Fix some compiler warnings in newer versions of Clang. (flutter/engine#16733)

* 941aee3 [web] add comment to skipped safari test (flutter/engine#16737)

* 136a057 [web] Rename LineMetrics.text to LineMetrics.displayText (flutter/engine#16734)

* afe7968 [web] Paragraph.longestLine doesn't need to check for `isSingleLine` anymore (flutter/engine#16736)

* c3f4c1a Migrate Path to AssociateWithDartWrapper (flutter/engine#16753)

* d0c2418 Add support for Increase Contrast on iOS (flutter/engine#15343)

* 6d2cbb2 Roll src/third_party/skia bf5cb0f539e7..46f5c5f08b61 (2 commits) (flutter/engine#16732)

* f758eb9 Roll fuchsia/sdk/core/linux-amd64 from -u-iU... to 3rB22... (flutter/engine#16752)

* a4a1f4f Roll fuchsia/sdk/core/mac-amd64 from iYYAH... to 5B5jq... (flutter/engine#16744)

* 8caf6d1 Roll src/third_party/skia 46f5c5f08b61..9e8f60534464 (29 commits) (flutter/engine#16754)

* 340f855 Roll fuchsia/sdk/core/mac-amd64 from 5B5jq... to g1vJn... (flutter/engine#16755)

* 9a9abb7 Roll src/third_party/skia 9e8f60534464..d1c90e10f0ca (1 commits) (flutter/engine#16757)

* 2e12cdc Roll src/third_party/skia d1c90e10f0ca..998066127e0d (1 commits) (flutter/engine#16759)

* 566cfae Roll src/third_party/skia 998066127e0d..57bc977e124c (3 commits) (flutter/engine#16762)

* 73fdff1 Roll fuchsia/sdk/core/linux-amd64 from 3rB22... to PGfiE... (flutter/engine#16763)

* ecca175 Roll fuchsia/sdk/core/mac-amd64 from g1vJn... to mcI8X... (flutter/engine#16764)

* 4d50517 Roll src/third_party/skia 57bc977e124c..cc5415a8ce36 (1 commits) (flutter/engine#16767)

* 237ddb1 Roll src/third_party/skia cc5415a8ce36..1cec4d5e3d92 (2 commits) (flutter/engine#16769)

* 8da64e0 Roll src/third_party/dart 5829fc7829d5..c75256299280 (43 commits) (flutter/engine#16770)

* 0d87160 Roll src/third_party/skia 1cec4d5e3d92..7d252302268a (2 commits) (flutter/engine#16771)

* 1aef7a4 Delete FlutterAppDelegate_Internal.h (flutter/engine#16772)

* b87bb0a [web] Fix canvas leak when dpi changes. Evict from BitmapCanvas cache under… (flutter/engine#16721)

* e0e24f5 Roll src/third_party/skia 7d252302268a..03b8ab225fd7 (8 commits) (flutter/engine#16773)

* 38dc2ea [i18n] Deprecates fuchsia.timezone.Timezone (flutter/engine#16700)

* 92abb22 Reland "Lift restriction that embedders may not trample the render thread OpenGL context in composition callbacks." (flutter/engine#16711)

* 971122b [web] Reduce the usage of unnecessary lists in pointer binding (flutter/engine#16745)

* d670059 [web] Respect maxLines when calculating boxes for a range (flutter/engine#16749)

* 5496bb4 Roll src/third_party/skia 03b8ab225fd7..659cc1c90705 (4 commits) (flutter/engine#16774)

* bad1fbe Roll src/third_party/dart c75256299280..73f6d15665a3 (9 commits) (flutter/engine#16776)

* d2e2cc9 Roll fuchsia/sdk/core/mac-amd64 from mcI8X... to O6w2L... (flutter/engine#16777)

* 888a62c Revert "Enable lazy-async-stacks by-default in all modes (#16556)" (flutter/engine#16781)
NoamDev pushed a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
NoamDev added a commit to NoamDev/engine that referenced this pull request Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

accessibility affects: framework cla: yes platform-ios waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants