-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[w3c] ☂️ Web Props (Part 1) umbrella issue #34424
Comments
See companion issue related to styles #34425 |
I'd love to help out. This would be my first real open source contribution. Is there anything I should be aware of in order to get started? |
Summary: This adds the `readOnly` prop to TextInput as requested on #34424 mapping the existing `editable` prop to `readOnly` so that `readOnly={false}` maps to `editable={true}` and `readOnly={true}` represents ` editable={false}`. This PR also updates the TextInputExample on the RNTest in order to facilitate the manual QA of this. ## Changelog [General] [Added] - Add readOnly prop to TextInput component Pull Request resolved: #34444 Test Plan: 1. Open the RNTester app and navigate to the TextInput page 2. Test the `TextInput` component through the `Editable and Read only` section https://user-images.githubusercontent.com/11707729/185295132-036443c8-1d5e-4567-a15e-5f1173cb0526.mov Reviewed By: lunaleaps Differential Revision: D38912786 Pulled By: necolas fbshipit-source-id: faeb59ed8695732be682ec55406a2de0cb7e619a
Summary: This adds the Android only `rows` prop to TextInput as requested on #34424 mapping the existing `numberOfLines` prop to `rows`. This PR also updates the TextInputExample.android on the RNTester in order to facilitate the manual QA of this. ## Changelog [Android] [Added] - Add rows prop to TextInput component Pull Request resolved: #34488 Test Plan: 1. On Android open the RNTester app and navigate to the TextInput page 2. Test the `TextInput` component through the `Fixed number of lines` section https://user-images.githubusercontent.com/11707729/186300173-7de79799-25b8-48af-99c0-8e3abeae334f.mov Reviewed By: christophpurrer Differential Revision: D38981953 Pulled By: cipolleschi fbshipit-source-id: d4d84b3c0dac7342ba9a65e2491928fbc61ff4f1
Summary: This adds the Android only `rows` prop to TextInput as requested on facebook#34424 mapping the existing `numberOfLines` prop to `rows`. This PR also updates the TextInputExample.android on the RNTester in order to facilitate the manual QA of this. ## Changelog [Android] [Added] - Add rows prop to TextInput component Pull Request resolved: facebook#34488 Test Plan: 1. On Android open the RNTester app and navigate to the TextInput page 2. Test the `TextInput` component through the `Fixed number of lines` section https://user-images.githubusercontent.com/11707729/186300173-7de79799-25b8-48af-99c0-8e3abeae334f.mov Reviewed By: christophpurrer Differential Revision: D38981953 Pulled By: cipolleschi fbshipit-source-id: d4d84b3c0dac7342ba9a65e2491928fbc61ff4f1
Summary: As pointed out by efoken on #34424 (comment) we forgot we add the `option` value to the `role` prop, so this PR adds this missing value as requested on #34424. ## Changelog [General] [Added] - Add "option" to available role values Pull Request resolved: #35137 Test Plan: Ensure that CI is green as there isn't much to test in this case because we're just adding a value that maps to `undefined` Reviewed By: jacdebug Differential Revision: D40849497 Pulled By: NickGerleman fbshipit-source-id: 5e3e24c0ff05c361a7a8dc1ee1f20ba3fb6988ca
All the props listed here have been implemented. Thanks so much to everyone who helped here, especially @gabrieldonadel for helping from start to end! I'm going complete some updates to RNWeb so that it allows these props too. And then I will probably create a "Part 2" issue with a few more props from the RFC. I'll also be updating the RFC with more details about the Event and Element APIs, which will likely form new umbrella issues. |
If you have suggestions for more W3C props we could implement, please comment on "RFC: Reduce fragmentation across platforms". I will start to publish updates to that RFC in the coming weeks. Thanks |
👋 Been closely following along this work and just want to thank all of you for pushing this effort forward! Quick question: are there plans to align implementation/typescript values for accessibility props? I'm seeing react-native uses boolean while @types/react uses Booleanish which allows |
…ts (facebook#34552) Summary: This adds the ` aria-hidden` prop to `Pressable`, `TouchableBounce`, `TouchableHighlight`, `TouchableNativeFeedback`, `TouchableOpacity`, `TouchableWithoutFeedback` and `View` components as requested on facebook#34424, being an alias `importantforAccessibility='no-hide-descendants'` on Android and an alias for `accessibilityElementsHidden` on iOS. This PR also updates RNTester AccessibilityExample in order to facilitate the manual QA. ## Changelog [General] [Added] - Add aria-hidden prop to Pressable, View and Touchables components Pull Request resolved: facebook#34552 Test Plan: 1. Open the RNTester app and navigate to the Accessibility page 2. Test the `aria-hidden` prop through the `View with hidden children from accessibility tree` section, this can be tested either by enabling Voice Over if you're using a real device or through the Accessibility Inspector if you're using a simulator https://user-images.githubusercontent.com/11707729/187814455-6937e33e-7edd-434e-b7d3-ee6c03f635ca.mov Reviewed By: NickGerleman Differential Revision: D39206245 Pulled By: jacdebug fbshipit-source-id: 551dc671fbcedc824f253e22b8d7753c466838c7
…ht` and `src` props to the Image Component. (facebook#34481) Summary: This PR is for adding the support for `crossOrigin`, `referrerPolicy`, `width`, `height` and `srcSet` props to Image Component and mapping the `src` prop to `source.uri` of Image Component for the issue facebook#34424. An example is also added in the RNTester ImageExample. ## Changelog [General] [Changed] - Map the `src` prop to `source.uri` prop in Image Component. [General] [Added] - added `crossOrigin`, `referrerPolicy`, `width`, `height` and `srcSet` props to Image Component. Pull Request resolved: facebook#34481 Test Plan: 1. Navigate to Image Component Example in the RNTester app. 2. Contains an example of the Image component using the `src` and `srcSet` prop. 3. For headers, inspect the Image request using Flipper. <img src="https://user-images.githubusercontent.com/32268377/186153246-d7b72ce3-e082-46d9-87d1-aefacd3af34f.png" height="500" /> Reviewed By: christophpurrer Differential Revision: D38982041 Pulled By: cipolleschi fbshipit-source-id: dd6594e39b8f3b36cfcdafa35695254034f1fb7f
Summary: This adds aliasing for accessibility state, it's used as requested on facebook#34424. - [aria-disabled](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-disabled) to equivalent [accessibilityState.disabled](https://reactnative.dev/docs/accessibility#accessibilitystate) - [aria-busy](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy) to equivalent [accessibilityState.busy](https://reactnative.dev/docs/accessibility#accessibilitystate) - [aria-checked](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked) to equivalent [accessibilityState.checked](https://reactnative.dev/docs/accessibility#accessibilitystate) - [aria-expanded](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-expanded) to equivalent [accessibilityState.expanded](https://reactnative.dev/docs/accessibility#accessibilitystate) - [aria-selected](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected) to equivalent [accessibilityState.selected](https://reactnative.dev/docs/accessibility#accessibilitystate) ## Changelog [General] [Added] - Add aria-disabled, aria-busy, aria-checked, aria-expanded and aria-selected prop to core components <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> Pull Request resolved: facebook#34524 Test Plan: ```js <View aria-disabled={true} aria-selected={false} aria-checked={true} aria-expanded={true} aria-busy={true} style={{backgroundColor: '#527FE4', padding: 5}}> <Text style={{fontSize: 11}}>Blue background</Text> </View> ``` Reviewed By: cipolleschi Differential Revision: D39137790 Pulled By: jacdebug fbshipit-source-id: 27b5c56e91731ba36bb4754d9862286a7a8191bc
…ook#34555) Summary: This adds `aria-live` alias for `accessibilityLiveRegion`, it unifies aria-live and accessibilityLiveRegion and also maps `aria-live='off'` to `accessibilityLiveRegion='none'` as requested on facebook#34424 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General][Added] - Added aria-live alias for accessibilityLiveRegion. Pull Request resolved: facebook#34555 Test Plan: ```js <View aria-live="polite"> <Text>Clicked {this.state.count} times</Text> </View> <View aria-live="off"> <Text>Clicked {this.state.count} times</Text> </View> ``` Reviewed By: cipolleschi Differential Revision: D39206291 Pulled By: jacdebug fbshipit-source-id: fd2019e7047ff7ff6133fed39f1a70b5a9396f89
…k#34523) Summary: This unifies the Android only `autoComplete` and the iOS only `textContentType` TextInput props with the web `autoComplete` values as requested on facebook#34424. I left the `textContentType` prop and the current supported `autoComplete` values untouched in order to avoid having a breaking change. This also updates RNTester to include test cases using the new `autoComplete` values ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [General] [Changed] - Unify TextInput autoComplete and textContentType props Pull Request resolved: facebook#34523 Test Plan: 1. Open the RNTester app and navigate to the TextInput page 2. Test the `TextInput` component through the `Text Auto Complete` section https://user-images.githubusercontent.com/11707729/187118267-3b509631-7b84-47b7-a580-567a7f5b483f.mov Reviewed By: NickGerleman Differential Revision: D39104545 Pulled By: cipolleschi fbshipit-source-id: a0d4b1b9ab336854a741a9efe4a62c3da0b5c0f4
Summary: This adds aliasing for accessibility Value, it's used as requested on facebook#34424. - [aria-valuemax](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemax) to equivalent [accessibilityValue.max](https://reactnative.dev/docs/accessibility#accessibilityvalue) - [aria-valuemin](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuemin) to equivalent [accessibilityValue.min](https://reactnative.dev/docs/accessibility#accessibilityvalue) - [aria-valuenow](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuenow) to equivalent [accessibilityValue.now](https://reactnative.dev/docs/accessibility#accessibilityvalue) - [aria-valuetext](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-valuetext) to equivalent [accessibilityValue.text](https://reactnative.dev/docs/accessibility#accessibilityvalue) ## Changelog [General] [Added] - Add `aria-valuemax`, `aria-valuemin`, `aria-valuenow`, `aria-valuetext` as alias prop to `TouchableOpacity`, `View`, `Pressable` `TouchableHighlight` `TouchableBounce` `TouchableWithoutFeedback` `TouchableOpacity` components Pull Request resolved: facebook#34535 Test Plan: - Enable `talkback`. - Open the RNTester app and navigate to the Api's tab - Go to the `fake Slider Example for Accessibility Value `modes section <Image src="https://user-images.githubusercontent.com/22423684/187472543-05200d8d-2742-4096-a56c-41f81b440a97.png" height="600" width="300" /> Reviewed By: cipolleschi Differential Revision: D39206362 Pulled By: jacdebug fbshipit-source-id: e7ed263badac789d529dd21e961cda5302b031e3
Summary: - Adding [aria-label](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) alias for [accessibilityLabel](https://reactnative.dev/docs/accessibility#accessibilitylabel) facebook#34424 ## Changelog [General] [Added] - Add `aria-label` prop to `Button`, `View`, `Pressable` component Pull Request resolved: facebook#34502 Test Plan: ``` <Button onPress={() => onButtonPress('cancelled')} testID="cancel_button" color={theme.SystemRedColor} title="Cancel Application" aria-lable="Press to cancel your application!" /> ``` Reviewed By: NickGerleman Differential Revision: D39055178 Pulled By: cipolleschi fbshipit-source-id: 7513a4518dedd0834e99fa8e72b07e0dc0132b41
…ts (facebook#34522) Summary: This adds the `id` prop to `Text`, `TouchableWithoutFeedback` and `View` components as requested on facebook#34424 mapping the existing `nativeID` prop to `id`. As this components are inherited by others this also adds the `id` prop support to `Image`, `TouchableBounce`, `TouchableHighlight`, `TouchableOpacity` and `TextInput`. This PR also adds android tests ensuring that the `id` property is passed to the native view via the `nativeID` prop, these tests were based on the existing `nativeID` tests ([NativeIdTestCase.java](https://github.com/facebook/react-native/blob/main/ReactAndroid/src/androidTest/java/com/facebook/react/tests/NativeIdTestCase.java)). ## Changelog [General] [Added] - Add id prop to Text, TouchableWithoutFeedback and View components Pull Request resolved: facebook#34522 Test Plan: Ensure that the new `id` prop android tests pass on CircleCI Reviewed By: lunaleaps Differential Revision: D39089639 Pulled By: cipolleschi fbshipit-source-id: 884fb2461720835ca5048004fa79096dac89c51c
…cebook#34506) Summary: This adds the `aria-modal` prop to the components where it's used as requested on facebook#34424, mapping web [aria-modal](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-modal) to equivalent [accessibilityViewIsModal](iOS) ## Changelog [General] [Added] - Add aria-modal prop to basic component ## TestPlan Checked manually we are receiving the values by props. Pull Request resolved: facebook#34506 Reviewed By: jacdebug Differential Revision: D39060396 Pulled By: cipolleschi fbshipit-source-id: 80da100ff412b17ba29ddc6d811afb4b0207ac9f
Summary: This adds the `alt` prop to the `Image` component as requested on facebook#34424. Using this new `alt` prop enables the `accessibility` prop and passes down the alt text to `accessibilityLabel`. This PR also updates RNTester ImageExample in order to facilitate the manual QA. #### Open questions - ~~On web `alt` text is displayed on the page if the image can't be loaded for some reason, should we implement this same behavior if the `Image` component fails to load `source`?~~ Not for now ## Changelog [General] [Added] - Add alt prop to Image component Pull Request resolved: facebook#34550 Test Plan: 1. Open the RNTester app and navigate to the Image page 2. Test the `alt` prop through the `Accessibility Label via alt prop` section, this can be tested either by enabling Voice Over if you're using a real device or through the Accessibility Inspector if you're using a simulator https://user-images.githubusercontent.com/11707729/187790249-0d851363-c30e-41b6-8c24-73e72467f4ba.mov Reviewed By: lunaleaps Differential Revision: D39618453 Pulled By: cipolleschi fbshipit-source-id: 0e26b2574514e76ce7e98ddb578f587a9cc30ee9
…ok#34725) Summary: This adds the [aria-labelledby](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) prop to the components where it's used as requested on facebook#34424, equivalent [accessibilityLabelledBy](https://reactnative.dev/docs/accessibility#accessibilitylabelledby-android) ## Changelog [General] [Added] - Add aria-modal prop to basic component ## TestPlan - Enable talkback. - Open the RNTester app and navigate to the Api's tab - Go to the TextInput with aria-labelledby attribute section <img width="495" alt="Screenshot 2022-09-19 at 7 46 05 PM" src="https://user-images.githubusercontent.com/22423684/191038924-017dba93-ea7d-494d-ba6f-161e986f9b54.png"> Pull Request resolved: facebook#34725 Reviewed By: lunaleaps Differential Revision: D40176143 Pulled By: lunaleaps fbshipit-source-id: 003d1ab27bfd01b5c6d4c58a4de501ec7966359d
Summary: As pointed out by necolas on facebook#34424 (comment) we forgot we add the `role` prop mapping to the `Text` component. This PR adds a new `role` prop to `Text`, mapping the web `role` values to the already existing `accessibilityRole` prop and moves the `roleToAccessibilityRoleMapping` to a common file that can be imported by both the `Text` and `View` components as requested on facebook#34424. This PR also updates the RNTester AcessebilityExample to include a test using this new prop. ## Changelog [General] [Added] - Add role prop to Text component Pull Request resolved: facebook#34976 Test Plan: 1. Open the RNTester app and navigate to the Accessibility Example page 2. Test the `role` prop through the `Text with role = heading` section Reviewed By: yungsters Differential Revision: D40596039 Pulled By: jacdebug fbshipit-source-id: f72f02e8bd32169423ea517ad18b598b52257b17
Summary: `aria-checked` prop should accept `mixed` as value as given [here](https://www.w3.org/WAI/GL/wiki/Using_WAI-ARIA_aria-checked%3Dmixed) and also [accessibilityState.checked](https://reactnative.dev/docs/accessibility#accessibilitystate) accepts mixed to represent checkboxes. This change refers to issue facebook#34424 and PR facebook#34524 ## Changelog [General] [Added] - Added `mixed` value for `aria-checked`. Pull Request resolved: facebook#34633 Test Plan: ```js <TouchableOpacity accessibilityRole="checkbox" aria-checked="mixed" accessibilityHint="click me to change state"> <Text>Checkbox example</Text> </TouchableOpacity> ``` Reviewed By: lunaleaps Differential Revision: D39382158 Pulled By: necolas fbshipit-source-id: fa026274111305cc0bcbb42ed974ca1be7d779a5
Summary: As pointed out by efoken on facebook#34424 (comment) we forgot we add the `option` value to the `role` prop, so this PR adds this missing value as requested on facebook#34424. ## Changelog [General] [Added] - Add "option" to available role values Pull Request resolved: facebook#35137 Test Plan: Ensure that CI is green as there isn't much to test in this case because we're just adding a value that maps to `undefined` Reviewed By: jacdebug Differential Revision: D40849497 Pulled By: NickGerleman fbshipit-source-id: 5e3e24c0ff05c361a7a8dc1ee1f20ba3fb6988ca
@necolas I noticed that |
Add support for Web props to core components
Contingent on RFC feedback. This is the umbrella issue for basic React DOM / Web props support on React Native components, as described in this proposal: "RFC: Reduce fragmentation across platforms".
Each of the tasks listed below can be tackled with individual PRs that link back to this issue. Not every task has a known solution or implementation yet, so feel free to discuss implementation details in the comments. Each new prop should take priority over any existing equivalents.
Common props
These props should be supported by core components, i.e.,
<Image>
,<View>
,<Text>
,<TextInput>
, etc.Prop aliases
aria-label
alias foraccessibilityLabel
. feat: adding aria-label alias for accessibilityLabel #34502aria-labelledby
alias foraccessibilityLabelledBy
. feat : add aria labelled as alias for accessibilityLabelledBy #34725aria-modal
alias foraccessibilityViewIsModal
(iOS). feat: added aria-modal as alias for accessibilityViewIsModal(iOS) #34506id
alias fornativeID
. feat: Add id prop to Text, TouchableWithoutFeedback and View components #34522Accessibility State. #34524
aria-busy
alias foraccessibilityState.busy
.aria-checked
alias foraccessibilityState.checked
.mixed
value fix: add mixed to aria-checked typings #34633aria-disabled
alias foraccessibilityState.disabled
.aria-expanded
alias foraccessibilityState.expanded
.aria-selected
alias foraccessibilityState.selected
.Accessibility Value. #34535
aria-valuemax
alias foraccessibilityValue.max
.aria-valuemin
alias foraccessibilityValue.min
.aria-valuenow
alias foraccessibilityValue.now
.aria-valuetext
alias foraccessibilityValue.text
.Prop equivalents
aria-hidden
. feat: Add aria-hidden prop to Pressable, View and Touchables components #34552importantforAccessibility='no-hide-descendants'
(Android).accessibilityElementsHidden
(iOS).aria-live
. feat: added aria-live as a alias for accessibility-live-region #34555accessibilityLiveRegion
(Android).aria-live='off'
toaccessibilityLiveRegion='none'
.role
. Feat/role to accessibility role mapping #34538 (comment) & feat: Add role prop to Text component #34976accessibilityRole
but with full list of ARIA roles allowed.role='slider'
toaccessibilityRole='adjustable'
role='img'
toaccessibilityRole='image'
role='presentation'
toaccessibilityRole='none'
role='summary'
toaccessibilityRole='region'
role='option'
support.tabIndex
. feat: Add tabIndex prop to View component #344860
and-1
values only.tabIndex={0}
tofocusable={true}
(Android)tabIndex={-1}
tofocusable={false}
(Android)Example:
<Image>
propsThese props should be supported by
<Image>
.alt
. feat: Add alt prop to Image component #34550tintColor
prop to replace non-standardstyle.tintColor
. The tintColor style is currently forwarded to a native prop and should instead be exposed as a prop so that React Native for Web does not have to deopt styles for Image rendering. feat: Add tintColor prop to Image component #34534 (comment)These props are inter-related:
crossOrigin
andreferrerPolicy
should only apply ifsrc
orsrcSet
are defined; andsrc
should be ignored if a validsrcSet
is defined. The user-providedsource
prop should be ignored if a validsrc
orsrcSet
prop is also defined.#34481
crossOrigin
.crossOrigin='use-credentials'
tosource.headers['Access-Control-Allow-Credentials'] = true
.height
.referrerPolicy
.referrerPolicy
tosource.headers['Referrer-Policy'] = referrerPolicy
.src
.src
tosource.uri
.srcSet
.srcSet='path1 x1, path1 x2'
tosource=[{ uri: path1, scale: 1 }, { uri: path2, scale: 2 }]
.width
.Example mapping to
source
:Example:
<TextInput>
propsThese props should be supported by
<TextInput>
.autoComplete
. feat: Unify TextInput autoComplete and textContentType props #34523autoComplete
) and iOS (textContentType
) with Web (autoComplete
).enterKeyHint
. feat: added enterKeyHint prop to textInput #34482returnKeyType
values.enterKeyHint === 'enter'
toreturnKeyType = 'default'
enterKeyHint === 'done'
toreturnKeyType = 'done'
enterKeyHint === 'go'
toreturnKeyType = 'go'
enterKeyHint === 'next'
toreturnKeyType = 'next'
enterKeyHint === 'previous'
toreturnKeyType = 'previous'
enterKeyHint === 'search'
toreturnKeyType = 'search'
enterKeyHint === 'send'
toreturnKeyType = 'send'
inputMode
. feat: Add inputMode prop to TextInput component #34460keyboardType
values.inputMode === 'none'
toshowSoftInputOnFocus={false}
feat: Update TextInput inputMode to map "none" to showSoftInputOnFocus #35228inputMode === 'text'
tokeyboardType = 'text'
inputMode === 'decimal'
tokeyboardType = 'decimal-pad'
inputMode === 'email'
tokeyboardType = 'email-address'
inputMode === 'numeric'
tokeyboardType = 'numeric'
inputMode === 'search'
tokeyboardType = 'search'
inputMode === 'tel'
tokeyboardType = 'phone-pad'
inputMode === 'url'
tokeyboardType = 'url'
readOnly
. feat: Add readOnly prop to TextInput component #34444readOnly={false}
toeditable={true}
.readOnly={true}
toeditable={false}
.rows
(formultiline={true}
). feat: Add rows prop to TextInput component #34488rows
tonumberOfLines
(Android).Example
autoComplete
mapping:Examples:
Documentation
The text was updated successfully, but these errors were encountered: