Skip to content
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

Passing custom props to IdealImage #9930

Open
6 of 7 tasks
CommonGuy opened this issue Mar 8, 2024 · 2 comments
Open
6 of 7 tasks

Passing custom props to IdealImage #9930

CommonGuy opened this issue Mar 8, 2024 · 2 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@CommonGuy
Copy link

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

I want to pass custom properties (namely fetchpriority=high to improve Largest Contentful Paint) to the Image of ideal-image, but this gets ignored.

The property is rendered in dev (with ideal-image config disableInDev: true), but not in the build.

Reproducible demo

No response

Steps to reproduce

  1. Create <Image img={require('../screenshot.png')} alt="My screenshot" fetchpriority="high" />
  2. View output: fetchpriority isn't rendered

Expected behavior

The custom attributes should be rendered

Actual behavior

They aren't being rendered

Your environment

No response

Self-service

  • I'd be willing to fix this bug myself.
@CommonGuy CommonGuy added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Mar 8, 2024
@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Mar 8, 2024
@slorber
Copy link
Collaborator

slorber commented Mar 8, 2024

Yes, ideal images are simple <img> tags in dev (to be faster) and resized images in prod, using this historical dependency (a fork of a fork 😅):
https://github.com/slorber/docusaurus-react-ideal-image

That dependency probably does not let props pass through. I plan to internalize all this legacy code someday because currently, it's a bit hard to deal with it.

@CommonGuy
Copy link
Author

Yeah I noticed the "funny dependency graph" :) Also makes it hard to create a PR to fix this myself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

No branches or pull requests

3 participants
@slorber @CommonGuy and others