Handle `collapsed` class on triggers even when manually invoked

Fixes #13636.
Merge pull request #14686 from twbs/collapsed-class-manual-invocation

Handle `collapsed` class on triggers even when manually invoked