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

Fix accordion component calculations and header classes #262

Merged
merged 4 commits into from
Apr 29, 2024

Conversation

tahaokumus
Copy link
Contributor

This is a fix for #238

When accordion panels are rendered dynamically the order calculations won't work properly because the actual DOM render and FwbAccordionPanel.vue onMounted function order are reversed. So the last rendered element has the order 0. This happens when the key attribute is unique each time. For this reason, I have updated the order calculation to check the actual DOM index. I have explained this in detail below with screenshots.

I have added onUnmounted to delete panel references that are removed.

In the composable files, the panel count calculation is wrong because it checks the keys of the 'panel' object. It always has 3 props: id, isVisible, and order. So in the calculation, the panel count is always 3. I have updated this to check the keys of the 'panels' object.

Lastly, I have updated some classes to match flush accordion styles.


Accordion Panel Render Issue

To test this, I have added an input as the number of accordion panels. And made sure it's a full render each time, by updating the id. I have also passed the title as a prop to log the title.

image

Then I logged the calculated count and title (FwbAccordionPanel.vue)

image

Here is the result

image

image

Copy link

netlify bot commented Jan 20, 2024

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit 0e9c9ac
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/65ac35d4e237780008799551
😎 Deploy Preview https://deploy-preview-262--sensational-seahorse-8635f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@Sqrcz Sqrcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested it locally... and I can confirm that all off the issues are fixed 👌

Thank you 🙏

@Sqrcz Sqrcz merged commit d85bb4e into themesberg:main Apr 29, 2024
11 checks passed
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 this pull request may close these issues.

2 participants