This repository has been archived by the owner on Jun 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
0.12 feature support accessibility #149
Merged
Merged
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7ce648a
Merge remote-tracking branch 'upstream/0.12-dev' into 0.12-dev
acton393 fa45c8e
* [ios] support web accessibility standard about WAI
acton393 6a2da1f
* [ios] aria-label then string value
acton393 896ffe8
* [ios] bugfix div accessibility
acton393 c8a25b9
Merge remote-tracking branch 'upstream/0.12-dev' into 0.12-dev
acton393 c33e614
* [ios] add example for accessibility
acton393 9fc0336
* [ios] replace content description
acton393 d958281
Merge remote-tracking branch 'upstream/0.12-dev' into 0.12-dev
acton393 213a2a3
* [android] test
sospartan c15a718
* [android] add support for aria-label and aria-hidden
sospartan 56f596a
Merge branch '0.12-dev' of github.com:acton393/incubator-weex into ac…
sospartan 113a51b
* [ios] update accessibility case
acton393 6c6577e
* [android] add support for aria-label and aria-hidden
sospartan 808eb6a
Merge branch '0.12-dev' of github.com:acton393/incubator-weex into 0.…
acton393 ef2a8f6
* [ios] bugfix accessibility
acton393 d52af62
* [ios] remove unused
acton393 95ffdb6
Merge remote-tracking branch 'upstream/0.12-dev' into 0.12-dev
acton393 18af316
* [ios] add test-id support
acton393 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<template> | ||
<scoller style='top:30;left:30'> | ||
<div class='direction'> | ||
<text>role:button text btn </text> | ||
<text class='txt' role='button' aria-label='I am a button with text' >text button</text> | ||
</div> | ||
<div class='direction'> | ||
<text>role:button div btn </text> | ||
<div class='txt' role='button' aria-label='I am a button with div' > | ||
</div> | ||
</div> | ||
|
||
<div class='direction'> | ||
<text>role:input </text> | ||
<input class='input' aria-label='I am a input' placeholder='please input'></input> | ||
</div> | ||
<div class='direction'> | ||
<text>role:search </text> | ||
<input class='input' role='search' aria-label='I am a search item' placeholder='please input something to search'></input> | ||
</div> | ||
|
||
<div class='direction'> | ||
<text>role:link </text> | ||
<a class='a' role='link' href='http://g.tbcdn.cn/ali-wireless-h5/res/0.0.16/hello.js' aria-label='I am a link'></a> | ||
</div> | ||
|
||
<div class='direction'> | ||
<text>role:img </text> | ||
<image class='img' role='img' src="https://imgsa.baidu.com/baike/c0%3Dbaike92%2C5%2C5%2C92%2C30/sign=5f234c7e0d7b020818c437b303b099b6/d4628535e5dde711a1ca272da0efce1b9c1661d4.jpg" | ||
aria-label='I am a image,a little dog with brown hair'></image> | ||
</div> | ||
|
||
<div class='direction'> | ||
<text aria-hidden='true'>hidden from voice-over/talkback </text> | ||
<image class='img' aria-hidden='true' role='img' src="https://imgsa.baidu.com/baike/c0%3Dbaike92%2C5%2C5%2C92%2C30/sign=5f234c7e0d7b020818c437b303b099b6/d4628535e5dde711a1ca272da0efce1b9c1661d4.jpg" aria-label='I am a image'></image> | ||
</div> | ||
|
||
</scroller> | ||
</template> | ||
|
||
<style> | ||
.direction { | ||
flex-direction:row; | ||
margin-top:50; | ||
} | ||
.txt { | ||
border-width:2; | ||
border-color:red; | ||
border-radius:20; | ||
width:200; | ||
margin-left:20; | ||
padding-left:65; | ||
margin-top:-20; | ||
} | ||
|
||
.input { | ||
border-width:2; | ||
width:300; | ||
height:60; | ||
margin-top:-10; | ||
margin-left:20; | ||
border-radius:20; | ||
} | ||
.a { | ||
border-width:2; | ||
width:100; | ||
margin-left:20; | ||
background-color:green | ||
} | ||
.img { | ||
width:100; | ||
height:100; | ||
margin-left:20; | ||
margin-top:-20; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,6 +219,8 @@ - (UIView *)view | |
_view.wx_ref = self.ref; | ||
_layer.wx_component = self; | ||
|
||
[self _setWXComponentA11yInfo:_attributes]; | ||
|
||
[self _initEvents:self.events]; | ||
[self _initPseudoEvents:_isListenPseudoTouch]; | ||
|
||
|
@@ -428,6 +430,7 @@ - (void)_updateAttributesOnMainThread:(NSDictionary *)attributes | |
[self _updateNavBarAttributes:attributes]; | ||
|
||
[self updateAttributes:attributes]; | ||
[self _setWXComponentA11yInfo:attributes]; | ||
} | ||
|
||
- (void)updateStyles:(NSDictionary *)styles | ||
|
@@ -445,6 +448,23 @@ - (void)readyToRender | |
- (void)updateAttributes:(NSDictionary *)attributes | ||
{ | ||
WXAssertMainThread(); | ||
|
||
} | ||
|
||
- (void)_setWXComponentA11yInfo:(NSDictionary *)attributes | ||
{ | ||
if (attributes[@"role"]){ | ||
_role = [WXConvert WXUIAccessibilityTraits:attributes[@"role"]]; | ||
self.view.accessibilityTraits = _role; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. self.view maybe not ready here, |
||
} | ||
if (attributes[@"ariaHidden"]) { | ||
_ariaHidden = [WXConvert BOOL:attributes[@"ariaHidden"]]; | ||
self.view.accessibilityElementsHidden = _ariaHidden; | ||
} | ||
if (attributes[@"ariaLabel"]) { | ||
_ariaLabel = [WXConvert NSString:attributes[@"ariaLabel"]]; | ||
self.view.accessibilityValue = _ariaLabel; | ||
} | ||
} | ||
|
||
#pragma mark Reset | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.view maybe not ready here, please add this logic to [self view], too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not have to set this property for an accessibility element that represents a subclass of UIView, because such an object’s screen coordinates are already known.