Why does the drop down close #2029
-
I have a drop menu I've added an accordion inside of. This means the drop down needs to continue to be open unless clicked outside of. However, even when I add the autoClose option it still closes when I click in the menu. You'll note that I've added the data attribute option
I also removed the content and replace it with just a div (isolating out the accordion element) and the incorrect close behavior still occurs. What am I doing wrong here? Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Hi! Change |
Beta Was this translation helpful? Give feedback.
-
That worked. Did I miss this in the documentation somehow? Reviewed the page and it is quite specifically camelCase. |
Beta Was this translation helpful? Give feedback.
-
Those are the names of options that we use in JS. You can use them when initializing via JS, for example:
When providing options via data attributes, they need to be changed to the |
Beta Was this translation helpful? Give feedback.
-
Understood. I'm still trying to find where this is explained in the documentation—or is it a JavaScript convention I am unfamiliar with? |
Beta Was this translation helpful? Give feedback.
-
We do not specify that. Using kebab-case for data attributes in HTML and camelCase in JavaScript ensures consistency and readability. Kebab-case is preferred in HTML and for its readability, while camelCase is a standard convention in JavaScript. When JavaScript reads data attributes from HTML, it automatically converts them from kebab-case to camelCase. |
Beta Was this translation helpful? Give feedback.
Hi! Change
data-te-autoClose="outside"
todata-te-auto-close="outside"
. When using data attributes to add/change options, we have to use the kebab-case.