pwa-studio icon indicating copy to clipboard operation
pwa-studio copied to clipboard

[bug]: Image placeholder height gets overriden by tailwind preflight styles

Open TMNRokas opened this issue 3 years ago • 3 comments

Describe the bug

Placeholder of Image component is supposed to have a specific height, but it gets overridden by global img rule: node_modules/tailwindcss/lib/plugins/css/preflight.css Line: 247 img, video { max-width: 100%; height: auto; }

Above rule overrides height that is supposed to be set by attribute in: node_modules/@magento/venia-ui/lib/components/Image/image.js height={talonResourceHeight}

Since HTML attribute height has lower specificity than a rule from stylesheet, it gets overridden.

To reproduce

Steps to reproduce the behavior:

  1. Go to 'Venia demo page'
  2. Scroll down to footer
  3. Inspect logo, and particularly: <img loading="eager" title="Venia" alt="Venia" class="undefined image-placeholder_layoutOnly-1jH image-placeholder-1mM" height="18" src="img src" width="102">
  4. Placeholder height is incorrect - should be 18px as per element attribute. Instead it's set to auto and gets calculated to 127.5px.

Same issue can be inspected in header logo, but it's harder to visually see, because it overflows.

Expected behavior: .image-placeholder should have height of 18px.

Screenshots

image image

Possible solutions

Instead of adding height as HTML element attribute height={height} add it as style={{height: height + "px"}}'

Please complete the following device information:

  • Device: All
  • Browser: All
  • Browser Version: All
  • Magento Version: Any

Please let us know what packages this bug is in regards to:

  • [ ] venia-concept
  • [X] venia-ui
  • [ ] pwa-buildpack
  • [ ] peregrine
  • [ ] pwa-devdocs
  • [ ] upward-js
  • [ ] upward-spec
  • [ ] create-pwa

TMNRokas avatar Mar 14 '22 17:03 TMNRokas

Hi @TMNRokas. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Mar 14 '22 17:03 m2-assistant[bot]

@magento export issue to JIRA project PWA as Bug

anthoula avatar Mar 21 '22 14:03 anthoula

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/PWA-2706 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Mar 21 '22 14:03 github-jira-sync-bot

@magento I am working on this

Sahilsks avatar Feb 20 '23 04:02 Sahilsks

Hi @TMNRokas, The issue is not reproducible as the logo image is taking the height as 18px only.

Please find the steps which I followed for reproducing:

  1. Go to 'Venia demo page'
  2. Scroll down to footer
  3. Inspect logo, and particularly: Venia
  4. Placeholder height is incorrect - should be 18px as per element attribute. Instead it's set to auto and gets calculated to 127.5px.

PFA for the screenshot. Screenshot 2023-07-12 at 1 00 52 PM

Please let me know if I am missing anything.

glo80771 avatar Jul 12 '23 07:07 glo80771

As there is no update for more than two weeks, we are closing this ticket. Please feel free to open the issue if it still exists.

glo80771 avatar Aug 07 '23 05:08 glo80771