[@mantine/core] fix useCollapse remove collapsedStyles display: 'none' #7774
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Question: Is it safe to remove
display: nonefrom Collapse hidden styles?Context
I am considering removing
display: nonefrom the hidden styles in the Collapse component, and relying only onheight: 0andoverflow: hiddento hide content when collapsed.Why consider this change?
display: nonecauses issues with nested Collapses and prevents child animations from triggering correctly when the parent is reopened.display: noneallows for smoother transitions, better support for nested Collapses, and more consistent state updates for children.Accessibility Considerations
display: none, content is removed from the accessibility tree, which is sometimes desirable, but it also prevents focus management and dynamic content updates.height: 0andoverflow: hiddenkeeps the content in the DOM and accessibility tree. To address focus issues, we can blur any focused element inside a collapsed Collapse and usearia-hiddenortabIndexfor additional control.My Question
Are there any strong reasons or edge cases where we should keep
display: nonein Collapse, rather than just usingheight: 0andoverflow: hidden?display: nonefor the sake of animation and nested Collapse support?I would appreciate any feedback or concerns before proceeding with this change.
fix: #6447
@rtivital
If there are any concerns about accessibility or specific use-cases that require
display: none, please let me know!