Skip to content

Conversation

@portikM
Copy link
Member

@portikM portikM commented Oct 27, 2025

Summary

Addresses: https://konghq.atlassian.net/browse/TDX-6738

Fix CollapsibleSection chevron icon bug when clicking on dropdown in CollapsibleSection title, it toggles the chevron icon (recordings).

Before
https://github.com/user-attachments/assets/f63c54ba-b4d7-4b87-bfad-6879f368007d

After
https://github.com/user-attachments/assets/3212c9a1-6b61-42a7-875f-0d99ccc5dc1d

Other misc refactors:

  • CollapsibleSection.vue chevron icon size (use token variable instead of hardcoded)
  • useTemplateRef in bunch of places
  • useEventListener instead of addEventListener where appropriate

@kongponents-bot
Copy link
Collaborator

Install the preview package from this PR

@kong/spec-renderer@pr-738


<script lang="ts" setup>
import { ref, useAttrs, computed } from 'vue'
import { ref, useAttrs, computed, useTemplateRef } from 'vue'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { ref, useAttrs, computed, useTemplateRef } from 'vue'
import { useAttrs, computed, useTemplateRef } from 'vue'

Copy link
Contributor

@vaibhavrajsingh2001 vaibhavrajsingh2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some lint errors:

Image

Comment on lines +164 to 167
const auth2ComponentRef = useTemplateRef<Array<InstanceType<typeof TryItAuth2>>>('auth2ComponentTemplate')
const auth2ClientCredentialsAuth = async (): Promise<Response | undefined> => {
if (!auth2ComponentRef.value?.[0].auth2ClientCredentialsAuth) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also remove generic type from here, as it causes type assertion. Let Vue pickup the type itself, as it also helped catch a bug here: we were expecting auth2ComponentRef.value?.[0] to always exist, and hence were directly accessing auth2ClientCredentialsAuth on it.

Suggested change
const auth2ComponentRef = useTemplateRef<Array<InstanceType<typeof TryItAuth2>>>('auth2ComponentTemplate')
const auth2ClientCredentialsAuth = async (): Promise<Response | undefined> => {
if (!auth2ComponentRef.value?.[0].auth2ClientCredentialsAuth) {
const auth2ComponentRef = useTemplateRef('auth2ComponentTemplate')
const auth2ClientCredentialsAuth = async (): Promise<Response | undefined> => {
if (!auth2ComponentRef.value?.[0]?.auth2ClientCredentialsAuth) {

ref="model-property"
class="model-property"
ref="modelProperty"
class="modelProperty"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The class name shouldn't be changed.

Suggested change
class="modelProperty"
class="model-property"

const expanded = ref<boolean>(true)
const toggleState = (e: Event) => {
if (!(e.target as HTMLElement).dataset.selectDropdownTrigger) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment here on why we need to do this

Comment on lines +193 to +196
useEventListener(popoverTrigger.value, 'mouseenter', showPopover)
useEventListener(popoverTrigger.value, 'focus', showPopover)
useEventListener(popoverTrigger.value, 'mouseleave', hidePopover)
useEventListener(popoverTrigger.value, 'blur', hidePopover)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can pass multiple events as an array to useEventListener, like this useEventListener(popoverTrigger.value, ['mouseenter', 'focus'], showPopover).

Can you try it out and verify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants