Cannot use `h-screen` from Tailwind with XB

Created on 7 July 2025, 28 days ago

Overview

If I use the h-screen class from Tailwind, the page continues to grow indefinitely. It is common to use this class for heros / banners / sections that should be sized according to browsers height.

Proposed resolution

User interface changes

🐛 Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

🇫🇮Finland lauriii Finland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @lauriii
  • 🇬🇧United Kingdom jessebaker

    This is technically a duplicate of 🐛 Components with heigh in VH can cause the preview iFrame to expand infinitely in height Active but as no solution for that has been put forward yet, perhaps we can put in a hard-coded Tailwind specific fix for this class name.

  • 🇫🇮Finland lauriii Finland
  • First commit to issue fork.
  • Merge request !1313#3534490 "Cannot use h screen" → (Merged) created by bnjmnm
  • Pipeline finished with Failed
    18 days ago
    Total: 181s
    #550546
  • 🇺🇸United States bnjmnm Ann Arbor, MI

    I have an MR that will work for h-screen and any other 100VH situation, but > 100 VH settings would still be an issue. On the plus side, this covers far more use cases than HEAD, even if some linger.

  • Pipeline finished with Failed
    18 days ago
    Total: 819s
    #550562
  • 🇺🇸United States bnjmnm Ann Arbor, MI

    Found a way to handle any VH value, not just 100.

  • Pipeline finished with Success
    14 days ago
    Total: 795s
    #553160
  • 🇬🇧United Kingdom jessebaker

    It seems like this issue is now the catch all for VH related issues. I've added two other more specific issues as related but I think they will be fixed by @bnjmnm's solution in the MR which is not specific to Tailwind classes.

  • 🇺🇸United States bnjmnm Ann Arbor, MI
  • 🇫🇮Finland lauriii Finland

    Tried to test this manually and ran into an error:

    An unexpected error has occurred while rendering preview.
    
    Failed to execute 'querySelector' on 'Document': 'div#block-olivero-content > div.block__content > astro-island:nth-child(1) > section.bg-white.lg:grid.lg:h-screen.lg:place-content-center' is not a valid selector.
    

    This is the component I tested with:

    const Component = ({
      text = "Hero",
    }) => {
      return (
      <section className="bg-white lg:grid lg:h-screen lg:place-content-center">
        <div className="mx-auto w-screen max-w-screen-xl px-4 py-16 sm:px-6 sm:py-24 lg:px-8 lg:py-32">
          <div className="mx-auto max-w-prose text-center">
            <h1 className="text-4xl font-bold text-gray-900 sm:text-5xl">
              Understand user flow and
              <strong className="text-indigo-600"> increase </strong>
              conversions
            </h1>
      
            <p className="mt-4 text-base text-pretty text-gray-700 sm:text-lg/relaxed">
              Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eaque, nisi. Natus, provident
              accusamus impedit minima harum corporis iusto.
            </p>
      
            <div className="mt-4 flex justify-center gap-4 sm:mt-6">
              <a
                className="inline-block rounded border border-indigo-600 bg-indigo-600 px-5 py-3 font-medium text-white shadow-sm transition-colors hover:bg-indigo-700"
                href="#"
              >
                Get Started
              </a>
      
              <a
                className="inline-block rounded border border-gray-200 px-5 py-3 font-medium text-gray-700 shadow-sm transition-colors hover:bg-gray-50 hover:text-gray-900"
                href="#"
              >
                Learn More
              </a>
            </div>
          </div>
        </div>
      </section>
      );
    };
    
    export default Component;
    
  • 🇺🇸United States bnjmnm Ann Arbor, MI

    Looks like #11 was happening due to tailwind using colons in classnames. This has been addressed and a test was modified to include it as a use case.

  • 🇺🇸United States bnjmnm Ann Arbor, MI

    The change in Jesse's commit looks good - it's essentially the same logic as what it replaces, but uses information that was already in the component instead of having to perform additional steps to retrieve it. It seems OK if Jesse reviews the remainder of the MR.

  • Pipeline finished with Running
    12 days ago
    #555040
  • Pipeline finished with Failed
    12 days ago
    #555026
  • 🇺🇸United States bnjmnm Ann Arbor, MI
  • Pipeline finished with Skipped
    8 days ago
    #558586
  • Pipeline finished with Skipped
    8 days ago
    #558587
  • Pipeline finished with Skipped
    8 days ago
    #558588
  • 🇬🇧United Kingdom jessebaker
  • Verified below scenarios :

Production build 0.71.5 2024