You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/03/29 06:49:07 UTC

[15/18] incubator-weex git commit: * [ios] bugfix accessibility

* [ios] bugfix accessibility


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ef2a8f60
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ef2a8f60
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ef2a8f60

Branch: refs/heads/0.12-dev
Commit: ef2a8f60341415a67832cbca5e785a88724e340e
Parents: 808eb6a
Author: acton393 <zh...@gmail.com>
Authored: Tue Mar 28 11:35:41 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Mar 28 11:35:41 2017 +0800

----------------------------------------------------------------------
 .../WeexSDK/Sources/Component/WXComponent_internal.h    |  2 ++
 ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m     |  6 +-----
 ios/sdk/WeexSDK/Sources/Model/WXComponent.m             | 12 +++++++++---
 3 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ef2a8f60/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
index de0a125..98520b8 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
+++ b/ios/sdk/WeexSDK/Sources/Component/WXComponent_internal.h
@@ -194,4 +194,6 @@
 - (void)_updatePseudoClassStyles:(NSString *)key;
 
 - (void)_restoreViewStyles;
+
+- (void)_configWXComponentA11yWithAttributes:(NSDictionary *)attributes;
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ef2a8f60/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m b/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
index 05bd54d..350f9e2 100644
--- a/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
+++ b/ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m
@@ -137,6 +137,7 @@
                 [strongSelf setGradientLayer];
             }
             [strongSelf setNeedsDisplay];
+            [strongSelf _configWXComponentA11yWithAttributes:nil];
         }];
     }
 }
@@ -204,11 +205,6 @@
     if (_positionType == WXPositionTypeSticky) {
         [self.ancestorScroller adjustSticky];
     }
-    
-    if (0 == [[self.view subviews] count]) {
-        self.view.isAccessibilityElement = YES;
-        self.view.accessibilityFrame = [[self.view superview] convertRect:self.calculatedFrame toView:nil];
-    }
     [self layoutDidFinish];
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ef2a8f60/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
index 0e9b40d..96ba11e 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXComponent.m
@@ -219,7 +219,7 @@
         _view.wx_ref = self.ref;
         _layer.wx_component = self;
         
-        [self _setWXComponentA11yInfo:_attributes];
+        [self _configWXComponentA11yWithAttributes:_attributes];
         
         [self _initEvents:self.events];
         [self _initPseudoEvents:_isListenPseudoTouch];
@@ -240,6 +240,7 @@
         }
 
         [self _handleFirstScreenTime];
+        [self _configWXComponentA11yWithAttributes:nil];
         
         return _view;
     }
@@ -430,7 +431,7 @@
     [self _updateNavBarAttributes:attributes];
     
     [self updateAttributes:attributes];
-    [self _setWXComponentA11yInfo:attributes];
+    [self _configWXComponentA11yWithAttributes:attributes];
 }
 
 - (void)updateStyles:(NSDictionary *)styles
@@ -451,7 +452,7 @@
     
 }
 
-- (void)_setWXComponentA11yInfo:(NSDictionary *)attributes
+- (void)_configWXComponentA11yWithAttributes:(NSDictionary *)attributes
 {
     if (attributes[@"role"]){
         _role = [WXConvert WXUIAccessibilityTraits:attributes[@"role"]];
@@ -465,6 +466,11 @@
         _ariaLabel = [WXConvert NSString:attributes[@"ariaLabel"]];
         self.view.accessibilityValue = _ariaLabel;
     }
+    
+    // set accessibilityFrame for view which has no subview
+    if (0 == [self.subcomponents count]) {
+        self.view.isAccessibilityElement = YES;
+    }
 }
 
 #pragma mark Reset