I would
not mix
(1) natives rules and
(2) JavaScript to control the same feature. Use a 100% native solution or 100% JavaScript solution. Even when you use JavaScript rather than directly manipulating the DOM it is better practice to
emulate user input such as trigger a click event on a native button or link.