-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(*): remove vue-bind-once [KHCP-14269] #2535
fix(*): remove vue-bind-once [KHCP-14269] #2535
Conversation
✅ Deploy Preview for kongponents-sandbox ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kongponents ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Co-authored-by: Adam DeHaven <[email protected]>
@@ -110,7 +109,7 @@ const emit = defineEmits<{ | |||
const slots = useSlots() | |||
const attrs = useAttrs() | |||
|
|||
const inputId = attrs.id ? String(attrs.id) : useUniqueId() | |||
const inputId = attrs.id ? String(attrs.id) : useId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const inputId = attrs.id ? String(attrs.id) : useId() | |
const id = useId() | |
const inputId = computed(() => attrs.id ? String(attrs.id) : id) |
I think now this should be a computed ref as we now support dynamic user defined id
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'd name differently than id
just to not get confused with other properties, etc. Something like defaultId
might be more obvious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -134,6 +134,8 @@ const emit = defineEmits<{ | |||
|
|||
const { stripRequiredLabel } = useUtilities() | |||
|
|||
const fileInputId = attrs.id ? String(attrs.id) : useId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/components/KInput/KInput.vue
Outdated
@@ -175,8 +175,8 @@ const slots = useSlots() | |||
const attrs = useAttrs() | |||
|
|||
const isRequired = computed((): boolean => attrs?.required !== undefined && String(attrs?.required) !== 'false') | |||
const inputId = attrs.id ? String(attrs.id) : useUniqueId() | |||
const helpTextId = useUniqueId() | |||
const inputId = attrs.id ? String(attrs.id) : useId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make these computed, but the useId()
call would need to be made outside of the computed function and then referenced, similar to this:
const defaultId = useId()
const inputId = computed((): string => attrs.id ? String(attrs.id) : defaultId)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have an example in my first comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yep I missed that one 👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -100,7 +99,7 @@ const attrs = useAttrs() | |||
|
|||
const switchInputElement = ref<HTMLInputElement | null>(null) | |||
|
|||
const inputId = attrs.id ? String(attrs.id) : useUniqueId() | |||
const inputId = attrs.id ? String(attrs.id) : useId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -495,8 +495,8 @@ const defaultKPopAttributes = { | |||
const key = ref(0) | |||
const stagingKey = ref(0) | |||
|
|||
const multiselectWrapperId = attrs.id ? String(attrs.id) : useUniqueId() // unique id for the KLabel `for` attribute | |||
const multiselectKey = useUniqueId() | |||
const multiselectWrapperId = attrs.id ? String(attrs.id) : useId() // unique id for the KLabel `for` attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/components/KRadio/KRadio.vue
Outdated
@@ -177,7 +176,7 @@ const props = defineProps({ | |||
const slots = useSlots() | |||
const attrs = useAttrs() | |||
|
|||
const inputId = attrs.id ? String(attrs.id) : useUniqueId() | |||
const inputId = attrs.id ? String(attrs.id) : useId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
src/components/KSelect/KSelect.vue
Outdated
@@ -363,6 +364,8 @@ const emit = defineEmits<{ | |||
const attrs = useAttrs() | |||
const slots = useSlots() | |||
|
|||
const selectInputId = attrs.id ? String(attrs.id) : useId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -161,7 +160,7 @@ const value = computed({ | |||
}, | |||
}) | |||
|
|||
const textAreaId = attrs.id ? String(attrs.id) : useUniqueId() | |||
const textAreaId = attrs.id ? String(attrs.id) : useId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
## [9.14.22](v9.14.21...v9.14.22) (2024-12-12) ### Bug Fixes * remove vue-bind-once [KHCP-14269] ([#2535](#2535)) ([6d31fae](6d31fae))
🎉 This PR is included in version 9.14.22 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
Addresses: https://konghq.atlassian.net/browse/KHCP-14269
Remove dependancy on
vue-bind-once
. In all components, rely on VueuseId
instead ofnanoid
for generating unique values for accessibility attributes.