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

[Accordion] Item hight not using a controlled CSS Custom Property #1033

Closed
Westbrook opened this issue Oct 4, 2020 · 2 comments · Fixed by #1048
Closed

[Accordion] Item hight not using a controlled CSS Custom Property #1033

Westbrook opened this issue Oct 4, 2020 · 2 comments · Fixed by #1048
Labels
bug Results from a bug in the CSS implementation

Comments

@Westbrook
Copy link
Contributor

Description

There is an uncontrolled unit of measure used to calculate the height of the Accordion Header that ends up having the same value for medium and large themes. This is indicated in the below CSS samples and in the dist/vars.css file which lists the value as 40px rather than a derivative of a system wide custom property:

.spectrum-Accordion-itemIndicator {
    top: calc(
        (
                var(--spectrum-accordion-item-height, 40px) -
                    var(
                        --spectrum-accordion-item-border-size,
                        var(--spectrum-alias-border-size-thin)
                    )
            ) / 2 -
            var(
                --spectrum-accordion-icon-height,
                var(--spectrum-global-dimension-size-125)
            ) / 2
    );
}

 .spectrum-Accordion-itemHeading {
    height: var(--spectrum-accordion-item-height, 40px);
}

.spectrum-Accordion-itemHeader {
    min-height: calc(
        var(--spectrum-accordion-item-height, 40px) -
            var(
                --spectrum-accordion-item-border-size,
                var(--spectrum-alias-border-size-thin)
            )
    );
}

 .spectrum-Accordion-item.is-open>.spectrum-Accordion-itemHeader:after {
    height: calc(
        var(--spectrum-accordion-item-height, 40px) -
            var(
                --spectrum-accordion-item-border-size,
                var(--spectrum-alias-border-size-thin)
            )
    );
}

Steps to reproduce

  1. Go to https://opensource.adobe.com/spectrum-css/accordion.html
  2. Choose the "Large" size
  3. Observe how hovering on an Accordion Item causes the hover styling to bleed past the standard styling.

Expected behavior

A controlled variable ensures correct delivery across all scales and color sets.

Screenshots

image
image

Environment

  • Spectrum CSS version: Latest beta
  • Browser(s) and OS(s): observed on Chrome, macOS: though all environments are likely here.
@Westbrook Westbrook added the bug Results from a bug in the CSS implementation label Oct 4, 2020
@Westbrook
Copy link
Contributor Author

Upon closer review, this issue could also be avoided by not relying on this value all together and leveraging the following styles instead:

.spectrum-Accordion-itemIndicator {
    top: calc(
                50% -
            var(
                --spectrum-accordion-icon-height,
                var(--spectrum-global-dimension-size-125)
            ) / 2
    );
}

.spectrum-Accordion-itemHeading {
    height: auto;
    position: relative;
}

.spectrum-Accordion-itemHeader {
    min-height: calc(
        100% -
            var(
                --spectrum-accordion-item-border-size,
                var(--spectrum-alias-border-size-thin)
            )
    );
}

 .spectrum-Accordion-item.is-open>.spectrum-Accordion-itemHeader:after {
    height: calc(
        100% -
            var(
                --spectrum-accordion-item-border-size,
                var(--spectrum-alias-border-size-thin)
            )
    );
}

@lazd
Copy link
Member

lazd commented Oct 5, 2020

If that fixes the alignment of the icon, I'd accept a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Results from a bug in the CSS implementation
Projects
None yet
2 participants