-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: Automatically detect if wrapped Autocomplete collection supports virtual focus #8862
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
base: main
Are you sure you want to change the base?
Changes from all commits
7bd802a
2fc340b
f2cfed8
8c7ece4
f762894
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ import intlMessages from '../intl/*.json'; | |
import {mergeRefs, useResizeObserver, useSlotId} from '@react-aria/utils'; | ||
import {Node} from 'react-stately'; | ||
import {Placement} from 'react-aria'; | ||
import {PopoverBase} from './Popover'; | ||
import {Popover} from './Popover'; | ||
import {pressScale} from './pressScale'; | ||
import {ProgressCircle} from './ProgressCircle'; | ||
import {TextFieldRef} from '@react-types/textfield'; | ||
|
@@ -643,7 +643,7 @@ const ComboboxInner = forwardRef(function ComboboxInner(props: ComboBoxProps<any | |
description={descriptionMessage}> | ||
{errorMessage} | ||
</HelpText> | ||
<PopoverBase | ||
<Popover | ||
hideArrow | ||
triggerRef={triggerRef} | ||
offset={menuOffset} | ||
|
@@ -652,7 +652,11 @@ const ComboboxInner = forwardRef(function ComboboxInner(props: ComboBoxProps<any | |
UNSAFE_style={{ | ||
width: menuWidth ? `${menuWidth}px` : undefined, | ||
// manually subtract border as we can't set Popover to border-box, it causes the contents to spill out | ||
'--trigger-width': `calc(${triggerWidth} - 2px)` | ||
'--trigger-width': `calc(${triggerWidth} - 2px)`, | ||
// TODO: Unfortunately can't override via styles prop | ||
// need to unset the overflow otherwise we get two scroll bars | ||
padding: 0, | ||
overflow: 'unset' | ||
Comment on lines
+656
to
+659
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bit of gross, but needed if we want to completely migrate away from PopoverBase and replace it with Popover now that it directly uses the dialog rendered by RAC Popover. Also a bit annoying that we need to remember to override these... |
||
} as CSSProperties} | ||
styles={style({ | ||
minWidth: '--trigger-width', | ||
|
@@ -693,7 +697,7 @@ const ComboboxInner = forwardRef(function ComboboxInner(props: ComboBoxProps<any | |
</ListBox> | ||
</Virtualizer> | ||
</Provider> | ||
</PopoverBase> | ||
</Popover> | ||
</InternalComboboxContext.Provider> | ||
</> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,8 @@ export const ContextualHelp = forwardRef(function ContextualHelp(props: Contextu | |
offset={offset} | ||
crossOffset={crossOffset} | ||
hideArrow | ||
// TODO: Unfortunately, we can't pass these styles via the styles prop | ||
// since we don't want to actually allow modifying width and padding for the popover... | ||
Comment on lines
+106
to
+107
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since Popover shouldn't freely allow a user to modify its width and padding, there isn't a great way to go about setting those overrides for components using PopoverBase like ContextualHelp... |
||
styles={popover}> | ||
<RACDialog className={mergeStyles(dialogInner, style({borderRadius: 'none', margin: 'calc(self(paddingTop) * -1)', padding: 24}))}> | ||
<Provider | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still want to keep
disableVirtualFocus
as a prop so a user can opt out of the virtual focus behavior based on their use case