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

[accordion] Keep active Accordion in viewport #44002

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

@mui-bot
Copy link

mui-bot commented Oct 6, 2024

Netlify deploy preview

https://deploy-preview-44002--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 96625b0

@oliviertassinari oliviertassinari added the component: accordion This is the name of the generic UI component, not the React module! label Oct 6, 2024
@oliviertassinari oliviertassinari changed the title [material-ui][Accordion] Keep active Accordion in viewport [Accordion] Keep active Accordion in viewport Oct 6, 2024
@oliviertassinari oliviertassinari added the design This is about UI or UX design, please involve a designer label Oct 6, 2024
@oliviertassinari oliviertassinari changed the title [Accordion] Keep active Accordion in viewport [Accordion] Keep active Accordion in viewport Oct 6, 2024
@oliviertassinari oliviertassinari changed the title [Accordion] Keep active Accordion in viewport [accordion] Keep active Accordion in viewport Oct 6, 2024
@@ -73,6 +73,7 @@ const AccordionRoot = styled(Paper, {
},
},
[`&.${accordionClasses.expanded}`]: {
overflowAnchor: 'auto', // keep active accordion in the viewport
Copy link
Member

@oliviertassinari oliviertassinari Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have any impact? I see no change.

Same question for overflowAnchor: 'none', // Keep the same scrolling position it seems that we don't need this anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this have any impact? I see no change.

@oliviertassinari it does

A) (before) all accordions have overflowAnchor: 'none'

before-none-for_all.mp4

B) (after) all accordions have overflowAnchor: 'none' except expanded one

after-auto_for_expanded.mp4

C) no overflowAnchor at all

no_overflow_anchor_at_all.mp4

Same question for overflowAnchor: 'none', // Keep the same scrolling position it seems that we don't need this anymore.

There is a slight difference in B and C (after clicking second accordion)
In B you can see the first accordion
In C you can not see the first accordion

This was my proposal, I am okay with removing overflowAnchor: 'none'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw joy ui's accordion and it does not have overflowAnchor
ig we can remove it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

B) looks better, indeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you like me to make any changes to the PR?

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yash49 Check the "After fix" CodeSandbox in the description. Minimize the window and notice that the second accordion doesn't fully come into view when expanded.

@yash49
Copy link
Contributor Author

yash49 commented Nov 23, 2024

@yash49 Check the "After fix" CodeSandbox in the description. Minimize the window and notice that the second accordion doesn't fully come into view when expanded.

@ZeeshanTamboli did you open the site in new tab? or you only tried it in the integrated preview of CodeSandbox?

For me, I can randomly produce the issue in the integrated preview.
However, when I open the site in a new tab, I don't see the issue occurring there.

Maybe CodeSandbox(iframe) is doing something, but I am not sure; I could be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: accordion This is the name of the generic UI component, not the React module! design This is about UI or UX design, please involve a designer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[accordion] When large content is present in accordion. The active accordion is going out of viewport
4 participants