Skip to content
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

Adding support for aria-describedby attribute #1570

Open
ericj17 opened this issue Feb 21, 2017 · 10 comments · May be fixed by #4082
Open

Adding support for aria-describedby attribute #1570

ericj17 opened this issue Feb 21, 2017 · 10 comments · May be fixed by #4082
Labels
category/accessibility Issues or PRs related to accessibility issue/has-pr Issue has a PR attached to it that may solve the issue issue/reviewed Issue has recently been reviewed (mid-2020)

Comments

@ericj17
Copy link
Contributor

ericj17 commented Feb 21, 2017

Hi there,

We are looking to add aria-describedby attribute support in order to link help text and validation error elements to the react-select select input.

Proposing to add the following property the inputProps in Select.js

'aria-describedby': React.PropTypes.string,

Do you foresee any issues?

Thanks and Best Regards,
Eric

@bladey
Copy link
Contributor

bladey commented May 27, 2020

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest version.

If you feel this issue / pull request is still relevant and you'd like us to review it, please leave a comment and we'll do our best to get back to you.

@bladey bladey closed this as completed May 27, 2020
@bladey bladey reopened this Jun 11, 2020
@bladey bladey added category/accessibility Issues or PRs related to accessibility enhancement labels Jun 11, 2020
@bladey bladey linked a pull request Jun 11, 2020 that will close this issue
@bladey
Copy link
Contributor

bladey commented Jun 11, 2020

Re-opened due to pending PR #4082

@bladey bladey added issue/reviewed Issue has recently been reviewed (mid-2020) and removed category/enhancement labels Jun 12, 2020
@bladey bladey added the issue/has-pr Issue has a PR attached to it that may solve the issue label Jul 6, 2020
@weswilke
Copy link

Any luck here? I'd like to pass through aria-describedby.

@emilie-t-ledn
Copy link

Any news regarding this issue? There is no way to add aria-describedby whether its using the prop directly on the select or when using a custom component, since it seems custom Input is not used when using isSearchable=false

https://codesandbox.io/s/codesandboxer-example-forked-dd105r?file=/example.tsx

@srajeev91
Copy link

I used React-Select to create a multi-select dropdown within Formik. I'm experiencing the same issue as the person in the comment above mine. I'm using Formik's Error Message component to display errors, and therefore need to pass an aria-describedby in my react-select Select component that corresponds to the Formik Error component's id. Would really appreciate if the aria-describeby attribute that we pass to the Select could be appended to the existing aria-describedby

@jphawk
Copy link

jphawk commented Jan 12, 2023

I have exactly the same issue, I have a custom error message and I need to set aria-describedby for either Select or internal Input. Once I do it, it's getting overwritten by a default value coming. Not convenient at all :/

@ryanscottaudio
Copy link

same issue here, would love a response, seems like it's been a whole since this was looked at

@wbolduc
Copy link

wbolduc commented Jun 2, 2023

Bump

@adam-nicholas
Copy link

adam-nicholas commented Jun 28, 2023

Also having this issue @bladey any chance anyone is looking into this?

@wbolduc
Copy link

wbolduc commented Jun 28, 2023

Bit of a workaround for right now

const Input = (props: InputProps) => {
	const passed_describedby = props.selectProps["aria-describedby"];
	const describedby =
		props["aria-describedby"] +
		(passed_describedby ? " " + passed_describedby : "");
	return <components.Input {...props} aria-describedby={describedby} />;
};

Which you can plug into your Select with

<ReactSelect
	components={{
		Input,
	}}
/>

This works okay because describedby accepts multiple ids. If you are using describedby to identify your errors your resolved description ends up looking like this "Select... Required" Which I think is okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/accessibility Issues or PRs related to accessibility issue/has-pr Issue has a PR attached to it that may solve the issue issue/reviewed Issue has recently been reviewed (mid-2020)
Projects
None yet
9 participants