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

Aria-owns is empty when the searchable option is true #1667

Closed
jrubstein opened this issue Apr 12, 2017 · 2 comments
Closed

Aria-owns is empty when the searchable option is true #1667

jrubstein opened this issue Apr 12, 2017 · 2 comments

Comments

@jrubstein
Copy link

When the select is used as autocomplete, the aria-owns of the input is empty:

<input id="personal_state" aria-errormessage="personal.address.state-error" aria-invalid="false" autocomplete="off" role="combobox" aria-expanded="false" aria-owns="" aria-haspopup="false" aria-activedescendant="react-select-5--value" value="" style="width: 5px; box-sizing: content-box;">

Can we have a configuration where we can add the parent id? This way we can use the input props to add the attribute manually.

Complete markup:

<div class="Select select Select--single is-searchable has-value">
    <div class="Select-control"><span class="Select-multi-value-wrapper" id="react-select-5--value"><div class="Select-value"><span class="Select-value-label" role="option" aria-selected="true" id="react-select-5--value-item">CA</span>
    </div>
    <div class="Select-input" style="display: inline-block;">
        <input id="personal_state" aria-errormessage="personal.address.state-error" aria-invalid="false" autocomplete="off" role="combobox" aria-expanded="false" aria-owns="" aria-haspopup="false" aria-activedescendant="react-select-5--value" value="" style="width: 5px; box-sizing: content-box;">
        <div style="position: absolute; top: 0px; left: 0px; visibility: hidden; height: 0px; overflow: scroll; white-space: pre; font-size: 14px; font-family: Verdana, Geneva, sans-serif; font-weight: normal; font-style: normal; letter-spacing: normal;"></div>
    </div>
    </span><span class="Select-arrow-zone"><span class="Select-arrow"></span></span>
</div>
</div>
@jnachtigall
Copy link
Contributor

Can we have a configuration where we can add the parent id?

@jrubstein Instead of adding a default aria-owns attribute as prop I would suggest that aria-owns is only added as attribute if it is not empty. An empty aria-owns is invalid, but if there is no aria-owns then the given DOM structure is used to tell the client to which element some other element belongs (kind of the default behaviour). Which seems to be what you'd want to do by assigning a parent id to aria-owns...

What you think?

I am not a a11y expert, but to my understanding to achieve this a simply check whether ariaOwns is empty at this line should do:

react-select/src/Select.js

Lines 898 to 906 in 97e2ef0

const ariaOwns = classNames({
[`${this._instancePrefix}-list`]: isOpen,
});
return (
<div
{...divProps}
aria-expanded={isOpen}
aria-owns={ariaOwns}

If so, I'd add a simple PR.

jnachtigall added a commit to jnachtigall/react-select that referenced this issue Feb 28, 2018
jnachtigall added a commit to jnachtigall/react-select that referenced this issue Feb 28, 2018
Fix JedWatson#1667: Do not output invalid empty 'aria-owns' attr
jnachtigall added a commit to jnachtigall/react-select that referenced this issue Feb 28, 2018
jnachtigall added a commit to jnachtigall/react-select that referenced this issue Mar 7, 2018
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants