Nav item with dropdown but without link can't toggle dropdown collapse

I use a nestable nav element. When a top level item with a dropdown does not contain a link, the nav item text can only expand the dropdown but not close it. Only the caret icon is able to really toggle the dropdown but the text can only expand and not collapse it.

Basically I want the whole item to be a including the text (if it doesn’t have a href attribute) instead of just the caret icon.

Did you use a # for the link address?

No because <button> is the semantically correct tag to use in this instance.