Skip to content

fix: update alt text on NFT images #29744

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

Merged
merged 9 commits into from
Jan 30, 2025

Conversation

matteoscurati
Copy link
Contributor

@matteoscurati matteoscurati commented Jan 16, 2025

Description

This PR introduces significant improvements to the handling of alt text for NFT images within the application. The main changes include:

Removal of Unnecessary Conditions for Alt Text
In the NftDetails, NftFullImage, and NFTSendHeading components, the alt text for NFT images has been simplified by removing conditions that returned an empty string when the image was missing. Now, the alt text is always generated using getNftImageAlt.

Introduction of a Truncation Function for Alt Text
The nftTruncateAltText function has been added to ensure that the alt text does not exceed a predefined maximum length, improving accessibility and usability.

Updates to Tests

  • New tests have been added to cover use cases for the nftTruncateAltText function
  • Tests for getNftImageAlt have been updated to handle cases where name, tokenId, or description are not provided

Updates to Component Stories

  • The NftItem stories have been updated to use getNftImageAlt
  • A new story NoImageStory has been added to test behavior when the image is not present

Open in GitHub Codespaces

Related issues

Fixes: #26461

Manual testing steps

Follow the steps outlined in the issue #26461

Screenshots/Recordings

Before

After

Screenshot 2025-01-16 at 10 41 42

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@metamaskbot metamaskbot added the team-notifications DEPRECATED: Use "team-assets" instead label Jan 16, 2025
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@matteoscurati matteoscurati self-assigned this Jan 16, 2025
@matteoscurati matteoscurati changed the title fix: 🐛 update alt text on NFT images fix: update alt text on NFT images Jan 16, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [7aac07b]
Page Load Metrics (1639 ± 46 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint28819161570309148
domContentLoaded1449186016089546
load1476192116399646
domInteractive23187504421
backgroundConnect673312010
firstReactRender1599422813
getState415942
initialActions01000
loadScripts1040140011928842
setupStore65914189
uiStartup16762297189917685
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 225 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [159fdde]
Page Load Metrics (1904 ± 112 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint28525281760530254
domContentLoaded151923861873231111
load158124211904234112
domInteractive24177563617
backgroundConnect571232010
firstReactRender16106392612
getState598262813
initialActions0563126
loadScripts11291848140820096
setupStore65113136
uiStartup180830712215314151
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 225 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [6914afa]
Page Load Metrics (1919 ± 71 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16732337192115474
domContentLoaded16542271188114670
load16782330191914871
domInteractive26114552713
backgroundConnect1191352211
firstReactRender16103413014
getState782292512
initialActions01000
loadScripts12111718138412259
setupStore688202411
uiStartup193827642250224108
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 225 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [ba0ad9f]
Page Load Metrics (1794 ± 115 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint148123061797233112
domContentLoaded147022941764225108
load148023081794239115
domInteractive25190595124
backgroundConnect10105292512
firstReactRender1597452914
getState590202311
initialActions01000
loadScripts10721762132118890
setupStore867202010
uiStartup172129392079318152
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 225 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@matteoscurati matteoscurati marked this pull request as ready for review January 27, 2025 15:42
@matteoscurati matteoscurati requested review from a team as code owners January 27, 2025 15:42
@metamaskbot
Copy link
Collaborator

Builds ready [4a2deb1]
Page Load Metrics (1687 ± 54 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint52718461624274132
domContentLoaded14581827166011655
load14951854168711354
domInteractive20157483617
backgroundConnect105224167
firstReactRender1573392512
getState46013178
initialActions00000
loadScripts10521420122710651
setupStore65719189
uiStartup17172199193013866
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 225 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [950e0f5]
Page Load Metrics (1882 ± 89 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint39524971745480230
domContentLoaded15842405184918287
load16412468188218589
domInteractive27117472613
backgroundConnect870322412
firstReactRender16108423014
getState56714157
initialActions01000
loadScripts11281838137815575
setupStore888272613
uiStartup188827612204241116
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 225 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [56bc08d]
Page Load Metrics (1709 ± 78 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint42420591648324155
domContentLoaded14311987167514971
load14402014170916278
domInteractive258439189
backgroundConnect897352411
firstReactRender15100393115
getState666192010
initialActions00000
loadScripts10131434122211756
setupStore784222211
uiStartup170327442002247119
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 225 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@matteoscurati matteoscurati added this pull request to the merge queue Jan 30, 2025
Merged via the queue into main with commit 0b202e3 Jan 30, 2025
70 checks passed
@matteoscurati matteoscurati deleted the fix/alt-text-nft-images-should-be-trimmed branch January 30, 2025 16:48
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2025
@metamaskbot metamaskbot added the release-12.12.0 Issue or pull request that will be included in release 12.12.0 label Jan 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.12.0 Issue or pull request that will be included in release 12.12.0 team-notifications DEPRECATED: Use "team-assets" instead
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Bug]: Alt Text on NFT Images should be trimmed while image is resolving
5 participants