-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
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
[core] The hidden prop does not always visually hide elements #20452
Comments
I think this is a general issue with overriding |
@shtengel What's the use case for using |
|
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden. We had a pass discussion on the topic in #15178, luckily, we solved the issue without even trying :). However, we also have these components to consider: |
@oliviertassinari what do you mean changing the style? |
@shtengel Why are you using the <Container hidden={{A ? true : undefined }} /> did you consider using <Container sx={{ display: A ? 'none' : undefined }} /> or probably the best option: {A ? <Container /> : null} ? |
@oliviertassinari Not a major reason, just according to here: https://reactjs.org/docs/faq-styling.html |
In https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/hidden, we have:
I think that we should ignore 2. 3. and 4. I think that we should also ignore the use case to only set a node invisible (encourage inline style or CSS instead). I have a concern with 1. and especially with React suspense: oliviertassinari/react-swipeable-views#453 (comment), it might be important. On the other hand, a. I haven't seen any progress of the hidden prop in React, b. developers could always add an extra DOM node, c. what's the overhead of supporting hidden (we have 30+ components to update)? Out of this tradeoff equation, I'm leading toward recognizing the problem (it exists) but ignoring it (we have more to lose) => @eps1lon What do you think? |
@oliviertassinari im using the |
@oliviertassinari Ok :) Thanks for the quick reply! |
@shtengel I recommend you to use |
Ran into this gotcha today. First, the You can try this on any of the examples from the official docs. For example, playing around with CodeSandbox I see So yea, considering the above it's best to avoid the |
Re-opening since #20648 did not address the actual issue |
@topazbarziv Regarding #28460, do you have thoughts on #20452 (comment)? |
@oliviertassinari A little bit strange way, but good enough. Thank you. |
Im using the
hidden
prop ofContainer
to show only the current Tab and to hide the rest (copied from the Tabs example)was working fine until i upgraded to version 4.9.9 from version 4.9.1 (could be higher version but i think 4.9.1)
Current Behavior 😯
<Container hidden={tabIndex != 1}> </Container>
The Container is not hidden even though tabIndex = 1
Expected Behavior 🤔
Container should not be visible
Steps to Reproduce 🕹
<Container hidden={tabIndex != 1}>sdfsdfsdfds</Container>
https://codesandbox.io/s/empty-browser-n8fwh?fontsize=14&hidenavigation=1&theme=dark
Steps:
The text was updated successfully, but these errors were encountered: