-
Notifications
You must be signed in to change notification settings - Fork 15
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
[MOO-809]: Implement a11y for pluggable widgets #21
base: main
Are you sure you want to change the base?
Changes from all commits
f7320b4
091c5be
ccc256b
a573352
f6768fc
359680f
527c699
f1eb756
cf8b140
864b02a
11d137e
f3d6795
4b1f990
e90fa88
05fa51c
5f2440e
84c6cbf
447ceb1
bdc2a3f
85585aa
93592d6
33c7541
3d406f4
1f4b46a
652e6e1
4ed3048
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,21 +32,32 @@ export function AccordionGroup({ | |
visible, | ||
style | ||
}: AccordionGroupProps): ReactElement | null { | ||
const isAccessible = group.accessible === "yes"; | ||
return visible ? ( | ||
<View style={style.container}> | ||
<Pressable | ||
style={[style.header.container, icon === "left" && { flexDirection: "row-reverse" }]} | ||
onPress={collapsible ? () => onPressGroupHeader(group, index) : null} | ||
accessible={isAccessible} | ||
accessibilityLabel={ | ||
group.screenReaderCaption?.value || | ||
(group.headerRenderMode === "text" ? group.headerText.value : undefined) | ||
} | ||
accessibilityHint={group.screenReaderHint?.value} | ||
accessibilityState={{ expanded: isExpanded }} | ||
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. you can use |
||
> | ||
{group.headerRenderMode === "text" ? ( | ||
<Text style={[style.header[group.headerTextRenderMode], { flex: 1 }]}> | ||
<Text accessible={isAccessible} style={[style.header[group.headerTextRenderMode], { flex: 1 }]}> | ||
{group.headerText.value} | ||
</Text> | ||
) : ( | ||
<View style={{ flex: 1 }}>{group.headerContent}</View> | ||
<View accessible={isAccessible} style={{ flex: 1 }}> | ||
{group.headerContent} | ||
</View> | ||
)} | ||
{icon !== "no" && collapsible ? ( | ||
<GroupIcon | ||
accessible={isAccessible} | ||
isExpanded={isExpanded} | ||
iconCollapsed={iconCollapsed} | ||
iconExpanded={iconExpanded} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,16 @@ interface GroupIconProps { | |
iconCollapsed: DynamicValue<NativeIcon> | undefined; | ||
iconExpanded: DynamicValue<NativeIcon> | undefined; | ||
style: AccordionIconStyle; | ||
accessible: boolean; | ||
} | ||
|
||
export function GroupIcon({ iconCollapsed, iconExpanded, isExpanded, style }: GroupIconProps): ReactElement | null { | ||
export function GroupIcon({ | ||
iconCollapsed, | ||
iconExpanded, | ||
isExpanded, | ||
style, | ||
accessible | ||
}: GroupIconProps): ReactElement | null { | ||
const customIconsConfigured = iconCollapsed?.value ?? iconExpanded?.value; | ||
const customIconSource = iconCollapsed?.value || { type: "glyph", iconClass: "glyphicon-chevron-down" }; | ||
const customExpandedIconSource = iconExpanded?.value || { type: "glyph", iconClass: "glyphicon-chevron-up" }; | ||
|
@@ -41,11 +48,12 @@ export function GroupIcon({ iconCollapsed, iconExpanded, isExpanded, style }: Gr | |
}, [isExpanded, animatedValue]); | ||
|
||
return customIconsConfigured ? ( | ||
<View style={iconStyles}> | ||
<View accessible={accessible} style={iconStyles}> | ||
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. it would be nice if there is a caption for the icon |
||
<Icon icon={source} size={style.size} color={style.color} /> | ||
</View> | ||
) : ( | ||
<Animated.View | ||
accessible={accessible} | ||
style={[ | ||
iconStyles, | ||
{ | ||
|
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.
I am not sure if this is the right place to configure if the element is accessible or not, as if the accordion element is open by default then the children will be accessible still.