GotJimmy / accordion

Other
46 stars 43 forks source link

AccordionSection scrollIntoViewOfItems 2.5.1 #41

Closed xD4RYL closed 1 year ago

xD4RYL commented 1 year ago

AccordionSections have a great funciton that scrolls to the currently active accordion widget. The code has this part:

if (_isOpen && scrollIntoViewOfItems != ScrollIntoViewOfItems.none && listCtrl.controller.hasClients)

I don't know if it's only for me, but it only scrolls to the last closed accordion. I had to change the code im my project to get it working (so it scrolls to the last opened accordion) to:

if (!_isOpen && scrollIntoViewOfItems != ScrollIntoViewOfItems.none && listCtrl.controller.hasClients)

GotJimmy commented 1 year ago

Have you tried the included example app to see if the behavior works there for you?

JaseElder commented 6 months ago

I can confirm this behaviour is the same for me, and the code change above corrects it. Try it on an accordion where the accordion sections go beyond the viewable window, and open the last section. Without the fix, the section doesn't scroll up to appear visible. With the fix, it does.