Skip to content

Commit

Permalink
Fix field wrapper ref for Autosuggest
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhabib committed Mar 3, 2025
1 parent b3c220f commit b27c37b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,6 @@ export const Autosuggest = forwardRef(function <Value>(
id={id}
value={value.text}
prefix={undefined}
inputBoxRef={fieldRef}
secondaryIcon={
onClear ? (
<ClearField
Expand All @@ -758,7 +757,7 @@ export const Autosuggest = forwardRef(function <Value>(
}
>
{(overlays, fieldProps, icon, secondaryIcon) => (
<Box width="full">
<Box width="full" ref={fieldRef}>
<Box
component="input"
{...fieldProps}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,6 @@ export const BasePopover = ({
{children}
{!tabToExit && <ExitFocusCapture />}
</Box>
</BraidPortal>
{/* Todo - should this be portaled? */}
{type === 'popover' && (
<Box
onClick={(event) => {
event.stopPropagation();
Expand All @@ -358,13 +355,14 @@ export const BasePopover = ({
handleOnClose();
}
}}
pointerEvents="none"
position="fixed"
zIndex="modal"
top={0}
left={0}
className={styles.backdrop}
/>
)}
</BraidPortal>
</BasePopoverContext.Provider>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ import assert from 'assert';

import clsx from 'clsx';
import dedent from 'dedent';
import React, {
type ReactNode,
type AllHTMLAttributes,
Fragment,
type RefObject,
} from 'react';
import React, { type ReactNode, type AllHTMLAttributes, Fragment } from 'react';

import { textStyles } from '../../../css/typography';
import { useBackgroundLightness } from '../../Box/BackgroundContext';
Expand Down Expand Up @@ -101,7 +96,6 @@ type InternalFieldProps = FieldBaseProps &
prefix: ReactNode,
): ReactNode;
componentName: string;
inputBoxRef?: RefObject<HTMLElement>;
};

export const Field = ({
Expand All @@ -125,7 +119,6 @@ export const Field = ({
prefix,
required,
tabIndex,
inputBoxRef,
componentName,
...restProps
}: InternalFieldProps) => {
Expand Down Expand Up @@ -210,12 +203,10 @@ export const Field = ({

<Stack space="xsmall">
<Box
ref={inputBoxRef}
position="relative"
background={fieldBackground}
borderRadius="standard"
display="flex"
className={showSecondaryIcon ? styles.secondaryIconSpace : undefined}
>
{children(
overlays,
Expand Down Expand Up @@ -255,6 +246,7 @@ export const Field = ({
}),
touchableText.standard,
icon && !prefix ? styles.iconSpace : null,
showSecondaryIcon ? styles.secondaryIconSpace : undefined,
),
},
icon ? (
Expand All @@ -276,13 +268,13 @@ export const Field = ({
) : null,
secondaryIcon ? (
<Box
component="span"
position="absolute"
width="touchable"
height="touchable"
display="flex"
alignItems="center"
justifyContent="center"
position="absolute"
height="touchable"
width="touchable"
component="span"
top={0}
right={0}
>
Expand Down

0 comments on commit b27c37b

Please sign in to comment.