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

tabIndex cannot be dynamic #50

Closed
timtyrrell opened this issue May 27, 2016 · 8 comments
Closed

tabIndex cannot be dynamic #50

timtyrrell opened this issue May 27, 2016 · 8 comments

Comments

@timtyrrell
Copy link
Contributor

It is seems really unfortunate that you can't pass a tabIndex in as a parameter to an element, like:

<a onClick={ something() } tabIndex={ dynamicIndex } />

This triggers the "onclick-has-focus" rule. Do you have any thoughts on that?

@ljharb
Copy link
Member

ljharb commented May 27, 2016

@timtyrrell we can't see your example - can you enclose it in single or triple backticks?

@timtyrrell
Copy link
Contributor Author

timtyrrell commented May 27, 2016

Doh, my bad. Like if I am building a list of links, I want to send in a different index to each. I am new at the a11y stuff so tell me if I am off-base.

<a onClick={ something() } tabIndex={ dynamicIndex } />

@ljharb
Copy link
Member

ljharb commented May 27, 2016

well, you're passing the return value of something to onClick, not something itself - is that return value a function?

@timtyrrell
Copy link
Contributor Author

I am sorry to distract you, that was a totally fake part, I was only focused on the tabIndex piece:

<a onClick={ handleClick } tabIndex={ dynamicIndex } />

@timtyrrell
Copy link
Contributor Author

It is checking for a number, I just wondered if anyone had thoughts on if I am handling anything incorrectly

https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/src/rules/onclick-has-focus.js#L34

@beefancohen
Copy link
Contributor

you're right, it shouldn't warn in that case. fixing now, thanks!

@beefancohen
Copy link
Contributor

This is fixed in v1.2.3

@timtyrrell
Copy link
Contributor Author

@evcohen Sorry for the late "thanks!". On my todo list to check out still

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

No branches or pull requests

3 participants