File tree Expand file tree Collapse file tree 5 files changed +13
-0
lines changed
Expand file tree Collapse file tree 5 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export const TextInput = forwardRef<
2525 onChange,
2626 onSubmit,
2727 autoComplete,
28+ "aria-activedescendant" : ariaActivedescendant ,
2829 rightSection,
2930 ...rest
3031 } = props ;
@@ -52,6 +53,7 @@ export const TextInput = forwardRef<
5253 onChange = { onChange }
5354 onSubmit = { onSubmit }
5455 autoComplete = { autoComplete }
56+ aria-activedescendant = { ariaActivedescendant }
5557 />
5658 { rightSection }
5759 </ div >
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export const TextInput = forwardRef<
2222 onChange,
2323 onSubmit,
2424 autoComplete,
25+ "aria-activedescendant" : ariaActivedescendant ,
2526 rightSection,
2627 ...rest
2728 } = props ;
@@ -49,6 +50,7 @@ export const TextInput = forwardRef<
4950 onChange = { onChange }
5051 onSubmit = { onSubmit }
5152 autoComplete = { autoComplete }
53+ aria-activedescendant = { ariaActivedescendant }
5254 />
5355 ) ;
5456} ) ;
Original file line number Diff line number Diff line change @@ -273,6 +273,7 @@ export type ComponentProps = {
273273 onChange : ( event : ChangeEvent < HTMLInputElement > ) => void ;
274274 onSubmit ?: ( ) => void ;
275275 autoComplete ?: HTMLInputAutoCompleteAttribute ;
276+ "aria-activedescendant" ?: string ;
276277 } ;
277278 } ;
278279 Menu : {
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export const TextInput = forwardRef<
2323 onChange,
2424 onSubmit,
2525 autoComplete,
26+ "aria-activedescendant" : ariaActivedescendant ,
2627 rightSection, // TODO: add rightSection
2728 ...rest
2829 } = props ;
@@ -58,6 +59,7 @@ export const TextInput = forwardRef<
5859 onChange = { onChange }
5960 onSubmit = { onSubmit }
6061 ref = { ref }
62+ aria-activedescendant = { ariaActivedescendant }
6163 />
6264 </ div >
6365 { rightSection }
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ export const PromptSuggestionMenu = (props: PromptSuggestionMenuProps) => {
6868 const { selectedIndex, setSelectedIndex, handler } =
6969 useSuggestionMenuKeyboardHandler ( items , ( item ) => item . onItemClick ( ) ) ;
7070
71+ const activeDescendantId =
72+ items . length > 0 && selectedIndex >= 0 && selectedIndex < items . length
73+ ? `bn-suggestion-menu-item-${ selectedIndex } `
74+ : undefined ;
75+
7176 const handleKeyDown = useCallback (
7277 ( event : KeyboardEvent ) => {
7378 // TODO: handle backspace to close
@@ -108,6 +113,7 @@ export const PromptSuggestionMenu = (props: PromptSuggestionMenuProps) => {
108113 onChange = { handleChange }
109114 autoComplete = { "off" }
110115 rightSection = { props . rightSection }
116+ aria-activedescendant = { activeDescendantId }
111117 />
112118 </ Components . Generic . Form . Root >
113119 { items . length > 0 && (
You can’t perform that action at this time.
0 commit comments