liip / bootstrap-blocks-wordpress-plugin

Bootstrap Gutenberg Blocks for WordPress
https://wordpress.org/plugins/wp-bootstrap-blocks/
279 stars 60 forks source link

Add bootstrap accordion blocks #90

Closed Sishasong closed 11 months ago

Sishasong commented 2 years ago

Hi, I recently need to add a bootstrap accordion as block for gutenberg. I use your plugins to develop those block (accordion & accordion-item). It was the first time i develop a gutenberg block, i don't really how react works, i tried to follow your block structure and logic.

I hope you will accept my pull request or you will tell me what i should improve to accept this. May be i should have to add some unit test (i need to understand how those tests works first :p). Any tips are welcome. Sorry for my english...

tschortsch commented 2 years ago

Hi @Sishasong. Thanks a lot for the PR! Sorry that I didn't answer till now, was pretty busy the last few weeks. I will have a look at it as soon as possible.

amuhr-design commented 2 years ago

The accordion block solution by @Celian-Nematis works great (thanks!), however there is one issue with the "Always open" functionality: When you change or add text to the accordion items, the parent accordion id changes and therefore the other tabs do not close simultaneously, they stay open. Do you have any idea how to fix it?

Sishasong commented 2 years ago

The accordion block solution by @Celian-Nematis works great (thanks!), however there is one issue with the "Always open" functionality: When you change or add text to the accordion items, the parent accordion id changes and therefore the other tabs do not close simultaneously, they stay open. Do you have any idea how to fix it?

Hi @amuhr-design, Sorry for this late answer. First of all, i'm glad you like this feature. I'm not sure to understand what behavior do you except. I've made some test and it's works like bootstrap 5 Accordion works (check here => https://getbootstrap.com/docs/5.0/components/accordion/#always-open)

I'm working on the PR update to be up to date with master branch.

Sishasong commented 2 years ago

The accordion block solution by @Celian-Nematis works great (thanks!), however there is one issue with the "Always open" functionality: When you change or add text to the accordion items, the parent accordion id changes and therefore the other tabs do not close simultaneously, they stay open. Do you have any idea how to fix it?

Hi again @amuhr-design, i finally found what your issue is. It's not the "Always open" feature issue. parentClientId was not set when adding an accordion-item. It's fixed and the feature is update to date with master branch

amuhr-design commented 2 years ago

Hi @Sishasong, Thanks a lot for your efforts - the fix works like a charm. Problem solved =)