[UwU] Fix invalid <Select> popover IDs (#748)

- Removes `id`, `aria-labelledby`, and `aria-describedby` attributes
from the props returned from `react-aria` within its `<Popover>`
component
  #741
This commit is contained in:
Corbin Crutchley
2023-10-01 23:29:05 -07:00
committed by GitHub

View File

@@ -135,6 +135,11 @@ function ListBox(props: ListBoxProps) {
const { listBoxRef = ref, state } = props; const { listBoxRef = ref, state } = props;
const { listBoxProps } = useListBox(props, state, listBoxRef); const { listBoxProps } = useListBox(props, state, listBoxRef);
// As this is inside a portal (within <Popover>), nothing from Preact's useId can be trusted
// ...but nothing should be using these IDs anyway.
listBoxProps["id"] = undefined;
listBoxProps["aria-labelledby"] = undefined;
return ( return (
<ul {...listBoxProps} ref={listBoxRef} class={styles.optionsList}> <ul {...listBoxProps} ref={listBoxRef} class={styles.optionsList}>
{[...state.collection].map((item) => ( {[...state.collection].map((item) => (
@@ -159,6 +164,11 @@ export function Option({ item, state }: OptionProps) {
ref, ref,
); );
// As this is inside a portal (within <Popover>), nothing from Preact's useId can be trusted
// ...but nothing should be using these IDs anyway.
optionProps["aria-labelledby"] = undefined;
optionProps["aria-describedby"] = undefined;
return ( return (
<li <li
{...optionProps} {...optionProps}