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

aria-hidden should be replaced with native hidden attribute #356

Open
JackieHayduk opened this issue Aug 31, 2022 · 4 comments
Open

aria-hidden should be replaced with native hidden attribute #356

JackieHayduk opened this issue Aug 31, 2022 · 4 comments

Comments

@JackieHayduk
Copy link

When transitioning height - display none is removed and the aria-hidden causes issues with panels that have focusable content within them - aria-hidden should be replaced with the native hidden attribute
Screen Shot 2022-08-31 at 1 30 19 PM

@JackieHayduk
Copy link
Author

I understand that this has been updated in version 5.0 but when working on a project that doesn't use react 18 you have to use version4.0 - any way a patch can be added that uses native HTML without requiring React 18?

@ScorpAL
Copy link

ScorpAL commented Nov 9, 2022

@JackieHayduk How did you calculate max height of hidden panels?

@JackieHayduk
Copy link
Author

@ScorpAL we calculate the height of the inner content (within the inner-panel) in JS and use it as a CSS variable --max-height. See these screen shots. the "standard-container" class wraps the inner component in the panel which has a height but is hidden by the parents.

Screen Shot 2022-11-09 at 10 40 55 AM
Screen Shot 2022-11-09 at 10 41 05 AM

@ScorpAL
Copy link

ScorpAL commented Nov 9, 2022

@JackieHayduk Thank you.

Found another solution to resolve my problem.
Resolved just with CSS.

Great article from @nemzes Nelson Menezes
Animating height: auto - Posted Oct 31, 2021; updated Dec 15, 2021

Minimum reproducible example:

SCSS:

.panel {
    overflow: hidden;
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.35s;

    > .inner {
        min-height: 0;
        visibility: visible;
        opacity: 1;
        transition: opacity 0.35s;
    }

    &[hidden] {
        grid-template-rows: 0fr;

        > .inner {
            visibility: hidden;
            opacity: 0;
            transition: opacity 0.35s, visibility 0s 0.35s;
        }
    }
}

TSX

...
<AccordionItemPanel className={styles.panel}>
    <div className={styles.inner}>
        Your content
    </div>
</AccordionItemPanel>
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants