-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
feat: Add alt prop to Image component #34550
feat: Add alt prop to Image component #34550
Conversation
Base commit: 8cdc9e7 |
Base commit: 8cdc9e7 |
It's tricky, but I think we should do it. Pros:
Cons:
|
At this stage, I don't think we need to display the alt text if the image doesn't load. Often on web we try to prevent broken images breaking layout by hiding fallback text anyway. This is what RNWeb does today. We can always revisit this decision in the future once people start using it and if a case is made. |
bbd6b3e
to
d6e24d9
Compare
Ping @cipolleschi or @jacdebug to import |
34db210
to
2490538
Compare
Could someone please import this? @cipolleschi @NickGerleman @jacdebug @ryancat |
53027c8
to
f551198
Compare
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
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.
Can we also update the TS types?
f551198
to
44da077
Compare
Sure, I've just updated it |
The TS types are already out of sync with the Flow types, as they don't have props from the other merged Web PRs |
I'm actively updating them to catch up (like the accessibility, id ones) and for going forward, we can keep them up to date. |
Summary: While working on #34550 I noticed that a couple of words inside the RNTester package were misspelled, this gave me the idea to test other files as well using the VS Code extension [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) which unveiled quite a few other typos. ## Changelog [Internal] [Fixed] - Fix RNTester typos Pull Request resolved: #34757 Test Plan: Shouldn't require much testing as this is just fixing some typos inside the RNTester package. Reviewed By: dmytrorykun Differential Revision: D39722889 Pulled By: cortinico fbshipit-source-id: a575ab8337586c5fe2d68ce73d2aae27d24a6384
Hi @gabrieldonadel could you please fix the linting warning? After that I'll reimport this. ;) |
Sure thing, you're talking about these lint warnings that the github-actions bot commented, right? |
@cipolleschi I've pushed a commit fixing all warnings |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
c467683
to
989d8d8
Compare
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @gabrieldonadel in 71fda5e. When will my fix make it into a release? | Upcoming Releases |
Summary: While working on facebook#34550 I noticed that a couple of words inside the RNTester package were misspelled, this gave me the idea to test other files as well using the VS Code extension [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) which unveiled quite a few other typos. ## Changelog [Internal] [Fixed] - Fix RNTester typos Pull Request resolved: facebook#34757 Test Plan: Shouldn't require much testing as this is just fixing some typos inside the RNTester package. Reviewed By: dmytrorykun Differential Revision: D39722889 Pulled By: cortinico fbshipit-source-id: a575ab8337586c5fe2d68ce73d2aae27d24a6384
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
Summary
This adds the
alt
prop to theImage
component as requested on #34424. Using this newalt
prop enables theaccessibility
prop and passes down the alt text toaccessibilityLabel
. This PR also updates RNTester ImageExample in order to facilitate the manual QA.Open questions
On webNot for nowalt
text is displayed on the page if the image can't be loaded for some reason, should we implement this same behavior if theImage
component fails to loadsource
?Changelog
[General] [Added] - Add alt prop to Image component
Test Plan
alt
prop through theAccessibility 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 simulatorScreen.Recording.2022-08-31.at.18.41.15.mov