Skip to content

Commit

Permalink
feat: support accessibility for a elements
Browse files Browse the repository at this point in the history
fix #285
  • Loading branch information
jsamr committed Jun 4, 2021
1 parent 1accaf7 commit 6974ce6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/render-html/src/renderers/ARenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
DefaultTagRendererProps,
RenderHTMLPassedProps
} from '../shared-types';
import { GestureResponderEvent } from 'react-native';
import { AccessibilityProps, GestureResponderEvent } from 'react-native';
import AElement from '../elements/AElement';
import useNormalizedUrl from '../hooks/useNormalizedUrl';
import { useDocumentMetadata } from '../context/DocumentMetadataProvider';
Expand Down Expand Up @@ -50,9 +50,15 @@ export function useAElementProps<T extends TNode>(
if (typeof syntheticAnchorOnLinkPress !== 'function') {
return props;
}
const accessibilityProps: AccessibilityProps = {
accessible: true,
accessibilityRole: 'link'
};
return {
...props,
onPress: syntheticAnchorOnLinkPress
onPress: syntheticAnchorOnLinkPress,
textProps: accessibilityProps,
viewProps: accessibilityProps
};
}

Expand Down

0 comments on commit 6974ce6

Please sign in to comment.