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

[Tabs] Fix InkBar location for controlled component #8010

Merged
merged 1 commit into from
Sep 2, 2017
Merged

[Tabs] Fix InkBar location for controlled component #8010

merged 1 commit into from
Sep 2, 2017

Conversation

jgreubel
Copy link

@jgreubel jgreubel commented Sep 2, 2017

The InkBar was not checking to see if the controlled value was set before using the uncontrolled internal state of selectedIndex. selectedIndex gets updated on every click, but it should be ignored when tabs is setup in a controlled way.

My use case was setting my tabs as hyperlink (<a/> tags), and if a user opened the link in another browser tab, it would keep the correct tab highlighted (text color wise) but the inkbar would move to the tab that was just clicked.

I also updated the tests and added one for my case to test the highlighted tab and inkbar location instead of just the internal state.

@oliviertassinari oliviertassinari merged commit 2e2140d into mui:master Sep 2, 2017
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: tabs This is the name of the generic UI component, not the React module! labels Sep 2, 2017
@oliviertassinari
Copy link
Member

@jgreubel thanks

@oliviertassinari oliviertassinari changed the title [Tabs] Fix InkBar location for controlled Tabs (non-v1) [Tabs] Fix InkBar location for controlled Tabs Sep 2, 2017
@oliviertassinari oliviertassinari changed the title [Tabs] Fix InkBar location for controlled Tabs [Tabs] Fix InkBar location for controlled component Sep 2, 2017
djbuckley added a commit to manchesergit/material-ui that referenced this pull request Sep 14, 2017
* call_em_all_-_master/master:
  [EnhancedButton] -- Prevent href being overwritten by undefined. (mui#8103)
  [CardMedia] Guard against null children and overlays (mui#8055)
  [Docs] Add v0.19.1 to versions.json
  v0.19.1
  [CHANGELOG] Prepare v0.19.1
  Have the InkBar in the Tabs component honor the value prop (mui#8010)
  [AutoComplete] Fix bug where controlled component behaves uncontrolled. (mui#7967)
  stop preventing event default on iconmenu open (mui#7933)
  Fix PopOver animation origin when horizontal=middle (mui#7930)
  [Slider] Resolve slider value to respect max and min (mui#7863)
  Update onNewRequest documentation to explain chosenRequest returns dataSource value. (mui#7835)
  [Docs] Add v0.19.0 to versions.json
  v0.19.0
  [CHANGELOG] Prepare v0.19.0
  [core] Add react^16.0.0-beta.5 in peer dependencies
  [DatePicker] Fixed bug where 'isSelectedDateDisabled' was returning undefined (mui#7735)
  Create CODE_OF_CONDUCT.md (mui#7704)
  Update related projects. (mui#7706)

# Conflicts:
#	src/internal/EnhancedButton.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: tabs This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants