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

No aria-expanded attribute on Spoiler component #3183

Closed
gitjeff05 opened this issue Dec 13, 2022 · 3 comments
Closed

No aria-expanded attribute on Spoiler component #3183

gitjeff05 opened this issue Dec 13, 2022 · 3 comments
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@gitjeff05
Copy link

What package has an issue

@mantine/core

Describe the bug

Spoiler component has no deterministic way of semantically describing the state of the component. Specifically, whether or not the spoiler is expanded. This makes it hard to apply custom styles for the two states. Other components, like the menu component, provide aria-expanded and data-expanded attributes that change based on whether the component is open or closed.

The only way I know to ensure the parent element holds the state is to attach my own classes to the parent -- which you can do by inspecting the button text (provided by showLabel and hideLabel props). However, since the buttons are always rendered sometime after the spoiler component, you must hack a way to check for the existence of the button first, then check the text, then apply my parent class.

What version of @mantine/hooks page do you have in package.json?

5.9.4

If possible, please include a link to a codesandbox with the reproduced problem

No response

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

No response

@7iomka
Copy link
Contributor

7iomka commented Mar 11, 2023

Also concerned about this issue
I have another goals - the use of a custom control, but, maybe this can be a partially workaround
Short: you need to create your own controlled control and sync it state with initialState of Spoiler, and trigger by controlRef click event when your custom control is clicked.

https://codesandbox.io/s/jolly-robinson-3sebvw

The one issue - is unable to set aria attributes to content
but it is required (Details)

@rtivital What do you think to add this internally?

@7iomka
Copy link
Contributor

7iomka commented Mar 11, 2023

rtivital added a commit that referenced this issue Sep 21, 2023
rtivital added a commit that referenced this issue Sep 21, 2023
@rtivital rtivital added the Fixed patch Completed issues that will be published with next patch (1.0.X) label Sep 21, 2023
@rtivital
Copy link
Member

The issue is resolved in 7.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

3 participants