Skip to content

Commit b07f806

Browse files
hussam-i-amfrancineluccarandall-krauskopflangermank
authored
feat(Autocomplete): Convert to CSS modules behind feature flag (#5453)
* test(AutoComplete): add e2e tests * test(vrt): update snapshots * fix(Autocomplete): wait for full render before e2e testing * test(vrt): update snapshots * fix dev storybook accessibility * fix lint * fix theme related a11y errors * test(vrt): update snapshots * ignore color-contrast rule * add aria-label to dialog * fix tests maybe? * remove playground snaps * test(vrt): update snapshots * retry mask * fix contrast failure * try to disable flaky test * test(vrt): update snapshots * feat(Autocomplete): Convert to CSS modules behind feature flag * remove rule * fix vrt test * format fix * update assertion * test(vrt): update snapshots * disable aria rule * add label * format fix --------- Co-authored-by: Marie Lucca <[email protected]> Co-authored-by: francinelucca <[email protected]> Co-authored-by: Marie Lucca <[email protected]> Co-authored-by: Randall Krauskopf <[email protected]> Co-authored-by: randall-krauskopf <[email protected]> Co-authored-by: Katie Langerman <[email protected]> Co-authored-by: langermank <[email protected]> Co-authored-by: hussam-i-am <[email protected]>
1 parent bd568fd commit b07f806

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

.changeset/eight-donuts-enjoy.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@primer/react": minor
3+
---
4+
5+
Convert Autocomplete to CSS modules behind feature flag
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.Overlay {
2+
overflow: auto;
3+
}

packages/react/src/Autocomplete/AutocompleteOverlay.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import type {ComponentProps} from '../utils/types'
66
import {AutocompleteContext} from './AutocompleteContext'
77
import {useRefObjectAsForwardedRef} from '../hooks/useRefObjectAsForwardedRef'
88
import VisuallyHidden from '../_VisuallyHidden'
9+
import {useFeatureFlag} from '../FeatureFlags'
10+
11+
import classes from './AutocompleteOverlay.module.css'
912

1013
type AutocompleteOverlayInternalProps = {
1114
/**
@@ -47,6 +50,8 @@ function AutocompleteOverlay({
4750
setShowMenu(false)
4851
}, [setShowMenu])
4952

53+
const enabled = useFeatureFlag('primer_react_css_modules_team')
54+
5055
if (typeof window === 'undefined') {
5156
return null
5257
}
@@ -60,9 +65,14 @@ function AutocompleteOverlay({
6065
ref={floatingElementRef as React.RefObject<HTMLDivElement>}
6166
top={position?.top}
6267
left={position?.left}
63-
sx={{
64-
overflow: 'auto',
65-
}}
68+
sx={
69+
enabled
70+
? undefined
71+
: {
72+
overflow: 'auto',
73+
}
74+
}
75+
className={enabled ? classes.Overlay : undefined}
6676
{...overlayProps}
6777
>
6878
{children}

0 commit comments

Comments
 (0)