Skip to content

chore(ActionList): Remove the CSS modules feature flag from the ActionList.Divider component #6022

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

Merged
merged 2 commits into from
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/curvy-lions-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': minor
---

Remove the CSS modules feature flag from the ActionList.Divider component
38 changes: 4 additions & 34 deletions packages/react/src/ActionList/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import React from 'react'
import Box from '../Box'
import {get} from '../constants'
import type {Theme} from '../ThemeProvider'
import type {SxProp} from '../sx'
import {merge} from '../sx'
import {clsx} from 'clsx'
import {useFeatureFlag} from '../FeatureFlags'
import classes from './ActionList.module.css'
import {defaultSxProp} from '../utils/defaultSxProp'
import {actionListCssModulesFlag} from './featureflag'
import {BoxWithFallback} from '../internal/components/BoxWithFallback'

export type ActionListDividerProps = SxProp & {
className?: string
Expand All @@ -18,38 +13,13 @@ export type ActionListDividerProps = SxProp & {
* Visually separates `Item`s or `Group`s in an `ActionList`.
*/
export const Divider: React.FC<React.PropsWithChildren<ActionListDividerProps>> = ({sx = defaultSxProp, className}) => {
const enabled = useFeatureFlag(actionListCssModulesFlag)
if (enabled) {
if (sx !== defaultSxProp) {
return (
<Box
className={clsx(className, classes.Divider)}
as="li"
aria-hidden="true"
sx={sx}
data-component="ActionList.Divider"
/>
)
}
return <li className={clsx(className, classes.Divider)} aria-hidden="true" data-component="ActionList.Divider" />
}
return (
<Box
<BoxWithFallback
Copy link
Preview

Copilot AI May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sx prop is destructured but never passed to BoxWithFallback, so any custom styling via sx will be ignored (and sx will trigger an unused-variable warning). Please forward sx={sx} to BoxWithFallback or remove it from the component signature.

Copilot uses AI. Check for mistakes.

className={clsx(className, classes.Divider)}
as="li"
aria-hidden="true"
sx={merge(
{
height: 1,
backgroundColor: 'actionListItem.inlineDivider',
marginTop: (theme: Theme) => `calc(${get('space.2')(theme)} - 1px)`,
marginBottom: 2,
listStyle: 'none', // hide the ::marker inserted by browser's stylesheet
},
sx as SxProp,
)}
className={className}
sx={sx}
data-component="ActionList.Divider"
/>
)
}
Divider.displayName = 'ActionList.Divider'
12 changes: 2 additions & 10 deletions packages/react/src/NavList/__snapshots__/NavList.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,6 @@ exports[`NavList renders a simple list 1`] = `
`;

exports[`NavList renders with groups 1`] = `
.c1 {
height: 1px;
background-color: var(--borderColor-muted,var(--color-action-list-item-inline-divider,rgba(208,215,222,0.48)));
margin-top: calc(8px - 1px);
margin-bottom: 8px;
list-style: none;
}

.c1:first-child {
display: none;
}
Expand Down Expand Up @@ -831,7 +823,7 @@ exports[`NavList renders with groups 1`] = `
>
<li
aria-hidden="true"
class="c1"
class="c1 Divider"
data-component="ActionList.Divider"
/>
<li
Expand Down Expand Up @@ -886,7 +878,7 @@ exports[`NavList renders with groups 1`] = `
</li>
<li
aria-hidden="true"
class="c1"
class="c1 Divider"
data-component="ActionList.Divider"
/>
<li
Expand Down
Loading