Detect: $page->isOpen() only when page is really open, not children

I like to use the following functionality:
<li class="<?= r(page('commerce')->isOpen(), 'active') ?>">

But I don’t want to have the <li> item .active when the children are open.
Is there a way to do this?

There are two different methods:

isOpen() is used to check if the page itself or its descendants are active.
isActive() on the other hands only checks if a page is actually active.

3 Likes