edenspiekermann / faster-react-tabs

MIT License
47 stars 6 forks source link

Features: React 0.14; Specifying visible index for tab panel #6

Open oyeanuj opened 8 years ago

oyeanuj commented 8 years ago

Hi @eschaefer! I was trying to make a decision on what react-tab component to use - I really like the simplicity of what you have but there are a couple of features that would be really helpful. I was wondering if you have any plans to add the following features -

  1. React 0.14 compatibility.
  2. Specify which tab index to show by default. Right now, it seems that the first one is selected by default. It seems like this functionality could be allowed by just exposing visibleIndex as a prop. Thoughts?
  3. Do the above, but dynamically. A good use-case is an interaction from the first tab that needs the second tab to be shown. Again, this could be achieved by exposing visibleIndex as a prop, I believe.

PS. Thank you for your quick response on #5!

Thank you!

KittyGiraudel commented 8 years ago

Yo! We will be moving the tab system to regular anchors for accessibility reasons (see #11), so you’ll be able to move from one tab to the other just by having a link anchoring to a specific tab. Regarding the initial index, we’re on it. :)

KittyGiraudel commented 8 years ago

Regarding React 0.14 compatibility, as far as I can tell the only difference is with ReactDOM.render(..) instead of React.render(..). Any idea how we could support both? Also, it’s not an error but a warning, so everything works fine on my end in React 0.14.

oyeanuj commented 8 years ago

Regarding React 0.14 compatibility... Any idea how we could support both?

Most packages seem to offer two versions, an older version that works with 0.13 and a newer one with 0.14. Most of the updates that they then do are on the newer version which supports 0.14.

We will be moving the tab system to regular anchors for accessibility reasons (see #11), so you’ll be able to move from one tab to the other just by having a link anchoring to a specific tab.

If you are doing anchor tags, does that also mean changing tabs will change the url in the address bar/history?

Regarding the initial index, we’re on it. :)

Great, thank you!

KittyGiraudel commented 8 years ago

If you are doing anchor tags, does that also mean changing tabs will change the url in the address bar/history?

Done.

oyeanuj commented 8 years ago

Okay, the only thing I can think of is cases where a developer might be using the tabs within another component or some part of the page. In that case, they might not want to have the url change change in the address bar/history.

Thoughts?

KittyGiraudel commented 8 years ago

I disagree. I think hash-based navigation is a key part of a tabbing system.