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

Dropdown: tabIndex rendered incorrectly #2093

Closed
kfuglsang opened this issue Sep 20, 2017 · 1 comment
Closed

Dropdown: tabIndex rendered incorrectly #2093

kfuglsang opened this issue Sep 20, 2017 · 1 comment
Assignees
Labels

Comments

@kfuglsang
Copy link

Steps

Passing prop tabIndex to Dropdown should set it as an attribute on the <input> element, not the containing <div> element.
Currently the tabindex is rendered on both the <div> and the <input> element.

Expected Result

<div name="template" role="combobox" aria-expanded="false" class="ui fluid search selection dropdown">
<input type="text" aria-autocomplete="list" autocomplete="off" class="search" tabindex="6" value="">
...
</div>

Actual Result

<div name="template" role="combobox" aria-expanded="false" class="ui fluid search selection dropdown" tabindex="6">
<input type="text" aria-autocomplete="list" autocomplete="off" class="search" tabindex="6" value="">
...
</div>

Version

0.73.1

@layershifter layershifter changed the title tabIndex rendered incorrectly for Dropdown Dropdown: tabIndex rendered incorrectly Sep 20, 2017
@layershifter
Copy link
Member

layershifter commented Sep 20, 2017

I've examined SUI examples and @kfuglsang is right, the search Dropdown shoud have tabIndex on input while regular Dropdown should have it on root div.

The logic below will be correct:

computeTabIndex = () => {
    const { disabled, search, tabIndex } = this.props

    // don't set a root node tabIndex as the search input has its own tabIndex
    if(search) return undefined
    if(disabled) return -1
    return _.isNil(tabIndex)) ? 0 :  tabIndex
  }

Assertion that root div doesn't have tabIndex with search prop should be also added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants