Skip to content

Apply dropdown li padding to label #691

@zachwill

Description

@zachwill

Relevant lines in _dropdown.css:

padding: calc(var(#{$css-var-prefix}form-element-spacing-vertical) * 0.5)
var(#{$css-var-prefix}form-element-spacing-horizontal);

The basic gist:

  1. If li:has(label)...
  2. Then the padding should actually be applied to the label rather than the li

With the padding being applied to the li instead, there's times when clicks don't reach the label and checkbox/radio button — even though the dropdown item is highlighted:

Image

By using li:has(label) then you could zero out the padding in this instance and apply it instead to the label. Pseudocode below:

details.dropdown > summary + ul li {
  padding: calc(…);

  /* li that directly contains a label */
  &:has(> label) {
    padding: 0;
  }

  /* the label inside */
  & > label {
    padding: calc(…);
  }
}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions