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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/mui-material/src/Accordion/Accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?

'&::before': {
opacity: 0,
},
Expand Down