Skip to content

fix(group): ignore hidden elements when rounding [role=search]/[role=group] corners - #748

Open
kght6123 wants to merge 3 commits into
picocss:devfrom
kght6123:fix/736-search-form-hidden-input
Open

kght6123 wants to merge 3 commits into
picocss:devfrom
kght6123:fix/736-search-form-hidden-input

Conversation

@kght6123

@kght6123 kght6123 commented Sep 1, 2026

Copy link
Copy Markdown

Summary

Fixes #736.

[role="search"] and [role="group"] decide which child gets the rounded corner via :first-child/:last-child. Those pseudo-classes count [hidden] / [type="hidden"] elements too, so a hidden field placed before/after the visible children flattens the rounded end of the group (as shown in the issue's JSFiddle repro).

This PR makes the left/right corner logic ignore [hidden] and [type="hidden"] elements when determining the visual first/last child:

  • Left side: uses a general sibling selector (:not([hidden], [type="hidden"]) ~ :not([hidden], [type="hidden"])), which works in all browsers.
  • Right side: uses :has() to detect a following visible sibling, gated behind @supports selector(:has(*)), with the original :not(:last-child) behavior kept as a fallback for browsers without :has() support.

Screenshots

Before fix — hidden input flattens the left corner of the search form:

before

After fix — rounded corners are preserved regardless of hidden input position:

after

Tested with: hidden input as first child, hidden attribute (non-type=hidden) as first child, and hidden input as last child — all render with correctly rounded corners, matching a normal search form with no hidden input.

Test plan

  • yarn lint / yarn build:css pass
  • yarn build (full pipeline: lint, compile, themes, autoprefix, minify) completes; all /css output regenerated and committed per CONTRIBUTING.md
  • Manually verified in Chromium via the issue's repro HTML (hidden input before/after the search input, and hidden attribute vs type="hidden")

…e=search]/[role=group] corners

Corner radius on [role="search"] and [role="group"] children was determined
via :first-child/:last-child, which counts hidden elements too. A hidden
input placed before/after the visible children flattened the rounded end
of the group.

Now the leftmost/rightmost visible child is determined by ignoring
[hidden] and [type="hidden"] siblings, using a general sibling selector
for the left side (all browsers) and :has() for the right side (with a
:not(:last-child) fallback for browsers without :has() support).

Fixes picocss#736

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant