Skip to content

Commit 8d60089

Browse files
committed
refactor(FR-2886): drop unused onResolvedNamesChange + clarify role prop comment
1 parent f50c681 commit 8d60089

30 files changed

Lines changed: 940 additions & 265 deletions

packages/backend.ai-ui/src/components/BAISelect.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const useStyles = createStyles(({ css, token }) => ({
9595
export interface BAISelectProps<
9696
ValueType = any,
9797
OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType,
98-
> extends Omit<SelectProps<ValueType, OptionType>, 'onSearch'> {
98+
> extends Omit<SelectProps<ValueType, OptionType>, 'onSearch' | 'role'> {
9999
ref?: React.RefObject<GetRef<typeof Select<ValueType, OptionType>> | null>;
100100
ghost?: boolean;
101101
autoSelectOption?:
@@ -108,6 +108,11 @@ export interface BAISelectProps<
108108
footer?: React.ReactNode;
109109
endReached?: () => void; // New prop for endReached
110110
searchAction?: (value: string) => Promise<void>;
111+
// antd v6 made `role` required on SelectProps. We Omit it from the
112+
// extended props and re-add it as optional with a sensible default so
113+
// callers don't have to spell it out at every call site. Override
114+
// (e.g. `role="listbox"`) when a specific ARIA role is needed.
115+
role?: SelectProps<ValueType, OptionType>['role'];
111116
}
112117

113118
function BAISelect<
@@ -123,6 +128,7 @@ function BAISelect<
123128
footer,
124129
endReached, // Destructure the new prop
125130
searchAction,
131+
role = 'combobox',
126132
...selectProps
127133
}: BAISelectProps<ValueType, OptionType>): React.ReactElement {
128134
const { value, options, onChange } = selectProps;
@@ -196,6 +202,7 @@ function BAISelect<
196202
<Tooltip title={tooltip}>
197203
<Select<ValueType, OptionType>
198204
{...selectProps}
205+
role={role}
199206
loading={isPending || selectProps.loading}
200207
showSearch={composedShowSearch}
201208
ref={ref}

0 commit comments

Comments
 (0)