mui / mui/material-ui

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

Open
#34,379 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

has workaround scope: accordion type: new feature waiting for 👍
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates

Possible solution is suggested for V1 but nothing is there in V5
https://github.com/mui/material-ui/issues/12568

Latest version
  • I have tested the latest version
Steps to reproduce 🕹

Steps:

  1. When large content is present in Accordion, the content is going out of viewport.
  2. Example link - https://codesandbox.io/s/distracted-sanne-rre74j?file=/demo.js
  3. Click on the first item to expand the accordion
  4. Now scroll to bottom and click on the 2nd to expand.
  5. Notice how the screen is not taken to the top of the accordion but stays at the bottom
Current behavior 😯

Screen stays at end of the expanded accordion

Expected behavior 🤔

Focus should be on top of the content on the expanded section

Context 🔦

No response

Your environment 🌎
npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the accordion behavior in the linked CodeSandbox and compare it with the prior issue at #12568. Expand the first item, scroll to the bottom, then expand the second; done means the expanded section's top is brought into view instead of leaving the screen at the previous bottom position.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.