slider icon indicating copy to clipboard operation
slider copied to clipboard

Can't set tabIndex on handle

Open gvincentlh opened this issue 9 years ago • 5 comments

We need to be able to disable tabbing into the rc-slider-handle by setting tabIndex="-1". Unfortunately it looks like tabIndex on the handle is currently hard-coded to "0", with no ability to override this value. https://github.com/react-component/slider/blob/76d4cf3567c48a43922f6a8c00f5b892e62d41e3/src/Handle.jsx#L28

Could you please add the ability to override tabIndex on the handle?

gvincentlh avatar Oct 31 '17 00:10 gvincentlh

It's for keyboard accessibility, could you explain why you need to disable it ? https://github.com/react-component/slider/pull/282

paranoidjk avatar Nov 03 '17 03:11 paranoidjk

@paranoidjk does the why really matter? We'd just like to have control over the tabIndex value on the handle. We want to create an explicit tab order on multiple page elements. Thanks.

gvincentlh avatar Nov 14 '17 00:11 gvincentlh

Then we maybe could add a api tabIndex: boolean | number (default to be 1, false to disable)

Would you like PR?

paranoidjk avatar Nov 14 '17 01:11 paranoidjk

@paranoidjk sounds good, yes will submit a PR tomorrow.

gvincentlh avatar Dec 19 '17 00:12 gvincentlh

@paranoidjk see the MDN docs on tabIndex here https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex

We should probably default it to "0" as it is now. Wouldn't want to break the existing behavior. But we should allow it to be overridden via props. I'll expose a tabIndex prop on both the Handle and Slider components. Slider would simply pass it through to Handle, so that we won't have to use a custom handle just to set tabIndex.

gvincentlh avatar Dec 19 '17 15:12 gvincentlh