Unfortunately, we had to restrict supported attributes in XWiki syntax to a list of allowed attributes for security reasons in XWiki 14.6. There are basically two options if you want to have the old behavior back:
Allowing just onclick by setting xml.htmlElementSanitizer.extraAllowedAttributes = onclick
Allowing all HTML attributes and elements by setting xml.htmlElementSanitizer = insecure.
HTML elements are primarily relevant for HTML macros authored by users without script right as they use the same cleaning.
Note that both options will introduce the possibility for cross site scripting (XSS) attacks by anyone who can write XWiki syntax. Depending on the configuration of your wiki, this can include guests when comments are allowed by guests.
If you don’t want to allow XSS, you could add a JSX (either just on that document or even on the whole wiki) that, e.g., looks for all elements with an attribute data-toggle-element and adds an onclick-handler to all these elements to toggle the element indicated in the attribute.
The workaround only works because the last author of the document containing the HTML macro has script right. If the macro was created by a user without script right or in a restricted context (like a comment), the onclick attribute would have been removed in the output (the clean-parameter is ignored in this case).