fix(FilteredActionList): prevent content-visibility from clipping item dividers#7696
fix(FilteredActionList): prevent content-visibility from clipping item dividers#7696francinelucca wants to merge 5 commits intomainfrom
Conversation
…m dividers The content-visibility: auto optimization on FilteredActionList items implicitly applies paint containment (contain: paint), which clips content that overflows the element box. Item dividers are rendered as ::before pseudo-elements on ActionListSubContent positioned at top: -7px, placing them 1px above the item boundary. Paint containment clips this overflow, making dividers invisible in SelectPanel and FilteredActionList when showItemDividers is enabled. This adds a rule that resets content-visibility to visible for items inside lists with data-dividers='true', restoring divider visibility while preserving the performance optimization for lists without dividers.
🦋 Changeset detectedLatest commit: 94e4239 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
There was a problem hiding this comment.
Pull request overview
Fixes a rendering bug in FilteredActionList/SelectPanel where item divider pseudo-elements are clipped when content-visibility: auto is applied to list items.
Changes:
- Adds a CSS override to disable
content-visibility: autofor action list items when dividers are enabled (data-dividers="true"). - Documents why paint containment from
content-visibilityclips the divider::beforepseudo-element.
|
👋 Hi from github/github-ui! Your integration PR is ready: https://github.com/github/github-ui/pull/16766 |
|
Integration test results from github/github-ui:
CI check runs linting, type checking, and unit tests. Check the workflow logs for specific failures. Need help? If you believe this failure is unrelated to your changes, please reach out to the Primer team for assistance. |
hectahertz
left a comment
There was a problem hiding this comment.
Looks good, nice find on the paint containment interaction. Worth keeping in mind that divider lists will lose the content-visibility optimization, but that's a fine tradeoff.
Summary
Item dividers in
SelectPanel(andFilteredActionList) are invisible even whenshowItemDividers={true}is set. The divider pseudo-elements exist in the DOM with correct styles but are visually clipped.Root Cause
The
content-visibility: autoperformance optimization inFilteredActionList.module.cssimplicitly appliescontain: paint(MDN reference), which clips any content that overflows an element's box — similar tooverflow: hidden.Item dividers are rendered as
::beforepseudo-elements onActionListSubContent, positioned attop: -7px(absolutely positioned relative to the sub-content span). This places the 1px divider line just above the<li>element's boundary. With paint containment active, this overflow is clipped and the dividers become invisible.The existing code already had a comment acknowledging this same issue for the active indicator
::afterpseudo-element (which is why focused/active items are excluded from thecontent-visibility: autorule), but dividers were not accounted for.Fix
Added a CSS rule that resets
content-visibilitytovisiblefor items inside lists withdata-dividers="true":This disables paint containment only when dividers are enabled, preserving the rendering performance optimization for all other lists.
Verification
Tested in Storybook at
Components / SelectPanel / Features / With Item Dividers— dividers now render correctly between items.