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

Collapse state is still not saved in user settings #7

Open
freshworkx opened this issue Sep 1, 2023 · 1 comment · May be fixed by #10
Open

Collapse state is still not saved in user settings #7

freshworkx opened this issue Sep 1, 2023 · 1 comment · May be fixed by #10

Comments

@freshworkx
Copy link

Collapsing some elements on a page and later revisiting the same page with the same user displays all elements in the expanded state. According to readme, I would expect the state of collapsed elements to be restored, same as #1.

I can confirm this behavior for TYPO3 11.5.30 and Collapse 1.0.0, the collapse state was not saved when I revisited the page.

After some troubleshooting, it looks like the field is not created in the user settings. You either do an addToList or removeFromList in PageModuleCollapse.js, but the field b13.collapse is never set.

I missed something like that in your PageModuleCollapse.js:

if (PersistentStorage.isset('B13.Collapse') === false) {
     PersistentStorage.set('B13.Collapse','');
}

On the first call, the field is created so that I can add or remove a value. This works for me.

sypets added a commit to sypets/collapse that referenced this issue Jun 24, 2024
@sypets sypets linked a pull request Jun 24, 2024 that will close this issue
@artus70
Copy link

artus70 commented Jun 24, 2024

Symptom: All elements were collapsed all the time.

Fix: I just found that it can be fixed by just changing the line

if (btn.ariaExpanded == 'true') {

to

if (btn.getAttribute('aria-expanded') == 'true') {

Appearantly the object attribute btn.ariaExpanded is not set reliably whereas the HTML attribute aria-expanded="true" is set correctly.

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

Successfully merging a pull request may close this issue.

2 participants