Skip to content

Commit

Permalink
fix: fix template for manage aria-attributes correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rhmkstk committed Aug 9, 2024
1 parent eaf9485 commit 22f8788
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
39 changes: 33 additions & 6 deletions packages/vue/src/components/MenuItem/LuiMenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ const props = defineProps({
type: Boolean as PropType<boolean>,
default: false,
},
disableWrapper: {
type: Boolean as PropType<boolean>,
default: false,
},
})
const slots = useSlots()
const menuItemRef = ref<HTMLElement>()
Expand Down Expand Up @@ -105,11 +109,14 @@ const computedAppendAndPrependClasses = computed(() => {
return Object.values(appendAndPrependClasses)
})
const computedDefaultSlotClasses = computed(() => {
const defaultSlotClasses: FlexGridInterface | LayoutInterface | TypographyInterface = {
display: 'flex flex-1',
alignItems: 'items-center',
textColor: 'text-inherit',
}
const defaultSlotClasses:
| FlexGridInterface
| LayoutInterface
| TypographyInterface = {
display: 'flex flex-1',
alignItems: 'items-center',
textColor: 'text-inherit',
}
return Object.values(defaultSlotClasses)
})
const focus = () => menuItemRef.value?.focus()
Expand All @@ -120,7 +127,7 @@ defineExpose({
</script>

<template>
<li>
<li v-if="!disableWrapper">
<component
:is="tag"
:id="menuItemId"
Expand All @@ -141,4 +148,24 @@ defineExpose({
</span>
</component>
</li>
<component
:is="tag"
v-else
:id="menuItemId"
ref="menuItemRef"
role="menuitem"
class="lui-menu-item"
:class="customStyle ? '' : computedMenuItemClasses"
v-bind="$attrs"
>
<span v-if="$slots.prepend" :class="computedAppendAndPrependClasses">
<slot name="prepend" />
</span>
<div :class="computedDefaultSlotClasses">
<slot />
</div>
<span v-if="$slots.append" :class="computedAppendAndPrependClasses">
<slot name="append" />
</span>
</component>
</template>
1 change: 1 addition & 0 deletions packages/vue/src/components/Tabs/LuiTabButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ const buttonSlotProps = computed(() => ({
:tabindex="buttonSlotProps.tabindex"
:aria-selected="buttonSlotProps.isSelected"
:aria-controls="injection?.context.panels[injection.context.selectedIndex]?.id"
:disable-wrapper="true"
:disabled="disabled"
class="relative whitespace-nowrap cursor-pointer after:w-full after:h-0.5 after:absolute after:z-20 after:left-0 after:bottom-0 after:inline-block after:rounded-full"
:class="[isSelected ? 'after:bg-primary-500' : 'after:bg-transparent']"
Expand Down

0 comments on commit 22f8788

Please sign in to comment.