[core] The hidden prop does not always visually hide elements
See original GitHub issueIm using the hidden
prop of Container
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)
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
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
- Works on 4.9.1 *
Steps:
- upgrade to version 4.9.9
- use a Container with hidden prop as True
Tech | Version |
---|---|
Material-UI | v4.9.9 |
React | v16.12.0 |
Chrome |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:16 (10 by maintainers)
Top Results From Across the Web
[core] The hidden prop does not always visually hide elements
Im using the hidden prop of Container to show only the current Tab and to hide the rest (copied from the Tabs example)...
Read more >Hidden content on the page cannot be analyzed | Axe Rules
As one of Deque's experimental rules, the Hidden Content rule automatically alerts you to the fact that there is visually hidden content on...
Read more >Inclusively Hidden | scottohara.me
The above “visually-hidden” class is utilizing various declarations to shrink an element into a 1px square, hiding any overflow, and absolutely ...
Read more >Angular 5 ngHide ngShow [hidden] not working - Stack Overflow
In an HTML element if hidden attribute is set to true browsers are supposed to hide the element from display, but the problem...
Read more >Making sure hidden frames are hidden - TPGi
While they can be easily hidden from visual display using CSS display:none , they are sometimes picked up by screen readers and other...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@shtengel I recommend you to use
<Container style={{ display: A ? 'none' : undefined }} />
or{A ? <Container /> : null}
unless you have a good reason to use hidden instead.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: https://github.com/oliviertassinari/react-swipeable-views/issues/453#issuecomment-417939459, 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) =>
won't fix
.@eps1lon What do you think?