twbs / ratchet

Build mobile apps with simple HTML, CSS, and JavaScript components.
http://goratchet.com
MIT License
14.63k stars 1.45k forks source link

Toggle switches are broken within segmented controls #838

Open thewax opened 8 years ago

thewax commented 8 years ago

Add a toggle switch inside a segmented control body and it will remove all "active" classes from the toggles within. This is because the class selector is removing any and all "active" classes from within that DIV.

eradin commented 7 years ago

This is a bug. To be more precise, the event should only remove "active" from control-content elements within that control set. But instead, it removes "active" from all elements contained in the parent container (activeBodies = targetBody.parentNode.querySelectorAll(classSelector);). If the parent container is 'content', the active class will be removed from all elements that use that class. So, any control like toggle or even a nested segment control will not work properly since each time a tab is clicked, all active classes are removed.

This really makes segment controls useful in limited implementations.