From 1abbdabe40aa371162f8231f29ce64e9a8640618 Mon Sep 17 00:00:00 2001 From: tugcekucukoglu Date: Wed, 11 Dec 2024 10:56:33 +0300 Subject: [PATCH] Fixed #6899 - Galleria: 'Indicator' Slot, Keyboard Accessibility Broken --- packages/primevue/src/galleria/Galleria.d.ts | 8 ++++++++ packages/primevue/src/galleria/GalleriaItem.vue | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/primevue/src/galleria/Galleria.d.ts b/packages/primevue/src/galleria/Galleria.d.ts index 43cd877e88..e481a0aded 100755 --- a/packages/primevue/src/galleria/Galleria.d.ts +++ b/packages/primevue/src/galleria/Galleria.d.ts @@ -467,6 +467,14 @@ export interface GalleriaSlots { * Index of the indicator item */ index: number; + /** + * Current active item index as a number. + */ + activeIndex: number; + /** + * Index of the element in tabbing order. + */ + tabindex: number; }): VNode[]; /** * Custom thumbnail template. diff --git a/packages/primevue/src/galleria/GalleriaItem.vue b/packages/primevue/src/galleria/GalleriaItem.vue index a6abf391a6..fe20beb8c7 100755 --- a/packages/primevue/src/galleria/GalleriaItem.vue +++ b/packages/primevue/src/galleria/GalleriaItem.vue @@ -29,7 +29,7 @@ :data-p-active="isIndicatorItemActive(index)" > - + @@ -216,7 +216,7 @@ export default { const indicators = [...find(this.$refs.indicatorContent, '[data-pc-section="indicator"]')]; const highlightedIndex = indicators.findIndex((ind) => getAttribute(ind, 'data-p-active') === true); - const activeIndicator = findSingle(this.$refs.indicatorContent, '[data-pc-section="indicator"] > button[tabindex="0"]'); + const activeIndicator = findSingle(this.$refs.indicatorContent, '[data-pc-section="indicator"] > [tabindex="0"]'); const activeIndex = indicators.findIndex((ind) => ind === activeIndicator.parentElement); indicators[activeIndex].children[0].tabIndex = '-1'; @@ -224,7 +224,7 @@ export default { }, findFocusedIndicatorIndex() { const indicators = [...find(this.$refs.indicatorContent, '[data-pc-section="indicator"]')]; - const activeIndicator = findSingle(this.$refs.indicatorContent, '[data-pc-section="indicator"] > button[tabindex="0"]'); + const activeIndicator = findSingle(this.$refs.indicatorContent, '[data-pc-section="indicator"] > [tabindex="0"]'); return indicators.findIndex((ind) => ind === activeIndicator.parentElement); },