Skip to content

feat(native): bind hoverWithinGroup to a named ancestor group - #636

Merged
Ernxst merged 1 commit into
mainfrom
bb/implement-571-named-hovergroup-thr_yusadnj35y
Sep 23, 2026
Merged

Ernxst merged 1 commit into
mainfrom
bb/implement-571-named-hovergroup-thr_yusadnj35y

Conversation

@Ernxst

@Ernxst Ernxst commented Sep 23, 2026

Copy link
Copy Markdown
Owner

A hoverWithinGroup name always bound to the outermost hoverGroup ancestor, so a descendant nested inside two groups couldn't target the inner one — Tailwind's group-hover/sidebar had no equivalent. Fixes #571.

Add a hoverWithinGroup name that binds hoverWithin to the nearest ancestor whose hoverGroup equals it, instead of the outermost marked ancestor:

<div style={{ hoverGroup: 'outer' }}>
  <div style={{ hoverGroup: 'inner' }}>
    <span
      style={{
        hoverWithinGroup: 'inner',
        hoverWithin: { backgroundColor: '#7c86ff' },
      }}
    />
  </div>
</div>

Hovering outer's own padding leaves the span unstyled; hovering inner styles it. Left unset, hoverWithin keeps following the outermost marked ancestor as before. A hoverWithinGroup naming no ancestor hoverGroup produces a style diagnostic instead of silently doing nothing.

packages/native/src/renderer.rs#L11474-L11487 resolves the binding each frame: unnamed picks the outermost marked ancestor (InheritedHoverGroup::first()); named walks the accumulated ancestor list from the innermost end for the first name match. The same resolution is duplicated for the boolean hover_within used by effective_display, transitions, and the <virtual-list> path, and for the JS-facing TestGpuixRenderer::get_resolved_style used by the React test suite.

Risk is confined to hoverWithin/hoverWithinGroup resolution: unnamed behavior is unchanged (verified by the existing nested-group test), and the new field is additive on StyleDesc.

Harness: Claude Code
Agent: none
Model: anthropic/claude-sonnet-5

Task statements
  1. Implement issue hoverGroup names are ignored: a descendant cannot choose which group it follows #571 on Ernxst/gpuix: make a descendant bind to a named ancestor hoverGroup via a new hoverWithinGroup field, matching Tailwind's group-hover/name semantics, while keeping the unnamed hoverGroup behavior unchanged; update the README API section and add a changeset. (Working-directory and workflow instructions omitted.)

🤖 Generated with Claude Code

hoverGroup names were parsed and then ignored: a descendant with
hoverWithin always bound to the outermost marked ancestor, so a nested
group couldn't be targeted independently (Tailwind's group-hover/name).

Add hoverWithinGroup, which binds hoverWithin to the nearest ancestor
whose hoverGroup equals that name instead of the outermost one. Unset,
hoverWithin keeps following the outermost marked ancestor. A name with
no matching ancestor group produces a style diagnostic.

Fixes #571

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Ernxst
Ernxst merged commit c601dae into main Sep 23, 2026
1 of 4 checks passed
@Ernxst
Ernxst deleted the bb/implement-571-named-hovergroup-thr_yusadnj35y branch September 23, 2026 16:15
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.

hoverGroup names are ignored: a descendant cannot choose which group it follows

1 participant