You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The component prop is a very web-specific feature and hole in the abstractions. When I first implemented View and Text in a mobile codebase at Twitter, this prop got badly named element because it was intended to set the HTML tag name of the resulting DOM node. It was adapted to support components and allow this kind of basic pattern:
import { Link } from 'react-router'
const MyComponent = () => <Text component={Link} to="/" size="large">Home</Text>
The idea of setting the HTML tag name was carried over to this implementation. But after implementing the core accessibility props – accessible, accessibilityLabel, and the introduction of accessibilityRole – and writing some components, I found myself either not using component in favour of the more semantic accessibilityRole, or setting them both to the same value.
So dropping component fixes the above problems. The accessibility props can be used to provide rich semantics and accessibility annotations. We can also map the role to an HTML element (<View accessibilityRole="main" /> => <main role='main' />) to provide improved legacy support for AT like JAWS.
The text was updated successfully, but these errors were encountered:
Problem
The
component
prop is a very web-specific feature and hole in the abstractions. When I first implementedView
andText
in a mobile codebase at Twitter, this prop got badly namedelement
because it was intended to set the HTML tag name of the resulting DOM node. It was adapted to support components and allow this kind of basic pattern:The idea of setting the HTML tag name was carried over to this implementation. But after implementing the core accessibility props –
accessible
,accessibilityLabel
, and the introduction ofaccessibilityRole
– and writing some components, I found myself either not usingcomponent
in favour of the more semanticaccessibilityRole
, or setting them both to the same value.Solution
@sebmarkbage and @vjeux have been tweeting related thoughts the last few days (e.g., https://twitter.com/sebmarkbage/status/646770556642045952) and Chrome's native elements have long been making heavy use of ARIA in their shadow dom implementation.
So dropping
component
fixes the above problems. The accessibility props can be used to provide rich semantics and accessibility annotations. We can also map the role to an HTML element (<View accessibilityRole="main" />
=><main role='main' />
) to provide improved legacy support for AT like JAWS.The text was updated successfully, but these errors were encountered: