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

[FormControl] Added zIndex of 0 to root style #13327

Merged
merged 2 commits into from
Oct 21, 2018

Conversation

drkohlipk
Copy link
Contributor

  • I have followed (at least) the PR section of the contributing guide.

  • Added zIndex of 0 to root style of FormControl.js to keep the label from rendering on top of fixed elements (such as BottomNavigation in certain uses).

Fixes #13246

@oliviertassinari oliviertassinari added the component: text field This is the name of the generic UI component, not the React module! label Oct 21, 2018
@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Oct 21, 2018
@oliviertassinari
Copy link
Member

I can confirm, the fix is working as expected:

oct -21-2018 19-49-41

@oliviertassinari oliviertassinari merged commit a424f2b into mui:master Oct 21, 2018
@oliviertassinari
Copy link
Member

@drkohlipk It's a great first pull request on Material-UI 👌🏻. Thank you for working on it!

@drkohlipk
Copy link
Contributor Author

Thanks @oliviertassinari! It looks like the top labels are also on top of the bottom nav at the moment, would you like me to whip something up really quickly for that as well since I have the environment spun up already?

@kitfit-dave
Copy link
Contributor

This change is causing an issue for me. Other elements that were set to z-index 1 to display over the FormControl (that was z-index: auto) now show up under it. This setting of z-index to 0 for the FormControl element seems like it might be a bit of a heavy handed way to fix the original issue.

@cilf
Copy link

cilf commented Oct 23, 2018

I had a similar issue. My react-select autocomplete inside TextField component is no longer able to use it's zIndex: 2 to position itself above another input mentioned later in the HTML. (FYI I'm still using older react-select integration).

screen shot 2018-10-23 at 3 47 33 pm

Reverted the change by

createMuiTheme({
  overrides: {
    MuiFormControl: {
      root: {
        zIndex: 'auto',
      }
    }
  }
});

from the documentation.

@mui mui deleted a comment from kitfit-dave Oct 23, 2018
@mui mui deleted a comment from kitfit-dave Oct 23, 2018
@oliviertassinari
Copy link
Member

@kitfit-dave Do you have a reproduction? We might just the component as its now if z-index: auto is more manageable than z-index: 0;.

@kitfit-dave
Copy link
Contributor

I'm sorry, I don't think I have time to make a simple repro right now... I am seeing this in my own AutoComplete component which is a FormControl that renders a position:absolute Paper element inside a position:relative div when downshift.isOpen. The form that it is in would then have other FormControls after it. To get the Paper to display over those next components, I am just setting z-index to something, and as (before this change) the FormControl root is z-index:auto, that displays the Paper over it (even though they are not siblings - which is the point of auto)

There is quite a difference between z-index:auto and z-index:[some value] - I would at least consider it a breaking change. I don't really understand the problem you were trying to solve with this change (for some reason I cannot see the images) so I can't make any suggestions there.

I am able to work around this by making my whole AutoComplete control z-index:1, but that is not what I want, only the Paper should display over the top.

@drkohlipk
Copy link
Contributor Author

Hmmmmm, I can take a deeper look to see what other solutions I can come up with. @oliviertassinari, would you like me to change it back to auto in the meantime?

@Tenkir
Copy link

Tenkir commented Oct 24, 2018

I am having issues with this fix as well. It is not the proper solve to handle this issue.

@oliviertassinari
Copy link
Member

oliviertassinari commented Oct 24, 2018

I'm happy to revert this change then. Anyone wants to handle it?

@Tenkir
Copy link

Tenkir commented Oct 24, 2018

What is the current process for regression testing in this repo? 3 days from PR to release seems rather quick for a repository of this size.

@oliviertassinari
Copy link
Member

@Tenkir The test suite is our safety belt. For issues like this one, we have visual regression tests. It's why we are asking people to provide a reproduction example, so we can add more tests. Do you have one?

@drkohlipk I'm in favor of reverting this change because it would make the text field implementation less opinionated, more predictable and easier to override. I hadn't anticipated these regressions. Do you want to work on it? :)

@drkohlipk
Copy link
Contributor Author

No worries @oliviertassinari, I'll have something in tonight! :-)

@kitfit-dave
Copy link
Contributor

kitfit-dave commented Oct 25, 2018

@drkohlipk
Copy link
Contributor Author

Revert PR up: #13380 @oliviertassinari

@oliviertassinari
Copy link
Member

@kitfit-dave I would have put the popover outside of the form control. But yeah, let's revert, thank you!

@kitfit-dave
Copy link
Contributor

Possibly... that does change dom structure, the FormControl is the output of a component, so moving the popup out would require wrapping the whole thing in something... Then I'd have the FormControl as the container sometimes but not others. Aaanyway, this is just how I noticed it. Seems to me like the revert / finding a more subtle way of fixing the original issue is the go.

Thanks for looking at this.

@oliviertassinari
Copy link
Member

Regarding the original issue, it can be fixed by setting a z-index. Trivial. I thought could have support it out of the box. Turns out, we can't, better have a great TextField DX than a great Bottom Button DX.

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: text field 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.

5 participants