Skip to content

Commit

Permalink
fix key nav on charts page (#13139)
Browse files Browse the repository at this point in the history
* fix key nav on charts page in cluster

* minor fixes to Select
  • Loading branch information
aalves08 authored Jan 24, 2025
1 parent 51bdc52 commit 3b0418f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 31 deletions.
6 changes: 6 additions & 0 deletions shell/assets/styles/base/_basic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ TEXTAREA,
}
}

.unlabeled-select {
&:focus-visible, &.focused {
@include focus-outline;
}
}

BUTTON,
.btn {
&:focus, &.focused {
Expand Down
1 change: 1 addition & 0 deletions shell/assets/styles/vendor/vue-select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
color: var(--dropdown-text);
white-space: nowrap;
z-index: 1000;
overflow: auto;

&:hover {
cursor: pointer;
Expand Down
8 changes: 7 additions & 1 deletion shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ catalog:
experimentalWarning: '{chartName} has been marked as experimental. Use caution when installing this helm chart as it might not function as expected.'
deprecatedAndExperimentalWarning: '{chartName} has been marked as deprecated and experimental. Use caution when installing this helm chart as it might be removed in the future and might not function as expected.'
charts:
refresh: refresh charts
all: All
categories:
all: All Categories
Expand All @@ -953,7 +954,7 @@ catalog:
all: All Operating Systems
linux: Linux
windows: Windows
search: Filter
search: Filter charts results
deprecatedChartsFilter:
label: Show deprecated apps
install:
Expand Down Expand Up @@ -6136,6 +6137,11 @@ validation:
interval: '"{key}" must be of a format with digits followed by a unit i.e. 1h, 2m, 30s'
tab: "One or more fields in this tab contain a form validation error"

carousel:
previous: Previous
next: Next
controlItem: Go to slide nº {number}

wizard:
previous: Previous
finish: Finish
Expand Down
65 changes: 36 additions & 29 deletions shell/components/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,33 +195,51 @@ export default {
</div>
</component>
</div>
<div
class="controls"
:class="{'disable': sliders.length === 1}"
>
<div
v-for="(slide, i) in slider"
:key="i"
class="control-item"
:class="{'active': activeItemId === i}"
@click="scrollSlide(i, slider.length)"
/>
</div>
<div
ref="prev"
role="button"
class="prev"
:aria-label="t('carousel.previous')"
:aria-disabled="sliders.length === 1"
:class="{'disable': sliders.length === 1}"
tabindex="0"
@click="nextPrev('prev')"
@keyup.enter.space="nextPrev('prev')"
>
<i class="icon icon-chevron-left icon-4x" />
<i
class="icon icon-chevron-left icon-4x"
/>
</div>
<div
ref="next"
role="button"
class="next"
:aria-label="t('carousel.next')"
:aria-disabled="sliders.length === 1"
:class="{'disable': sliders.length === 1}"
tabindex="0"
@click="nextPrev('next')"
@keyup.enter.space="nextPrev('next')"
>
<i
class="icon icon-chevron-right icon-4x"
/>
</div>
<div
class="controls"
:class="{'disable': sliders.length === 1}"
>
<i class="icon icon-chevron-right icon-4x" />
<div
v-for="(slide, i) in slider"
:key="i"
class="control-item"
:class="{'active': activeItemId === i}"
role="button"
tabindex="0"
:aria-label="t('carousel.controlItem', { number: i+1 })"
@click="scrollSlide(i, slider.length)"
@keyup.enter.space="scrollSlide(i, slider.length)"
/>
</div>
</div>
</template>
Expand All @@ -240,20 +258,6 @@ export default {
&.disable::after {
display: none;
}
&.disable:hover {
.prev,
.next {
display: none;
}
}
&:hover {
.prev,
.next {
display: block;
}
}
}
.slide-track {
Expand Down Expand Up @@ -367,13 +371,16 @@ export default {
position: absolute;
z-index: 20;
top: 90px;
display: none;
cursor: pointer;
&.disabled .icon {
color: var(--disabled-bg);
cursor: not-allowed;
}
.icon:focus-visible {
@include focus-outline;
}
}
.next {
Expand Down
13 changes: 12 additions & 1 deletion shell/components/SelectIconGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,23 @@ export default {
:is="asLink ? 'a' : 'div'"
v-for="(r, idx) in rows"
:key="get(r, keyField)"
:role="asLink ? 'link' : null"
:aria-disabled="asLink && get(r, disabledField) === true ? true : null"
:aria-label="get(r, nameField)"
:tabindex="get(r, disabledField) === true ? -1 : 0"
:href="asLink ? get(r, linkField) : null"
:target="get(r, targetField)"
:rel="rel"
class="item"
:data-testid="componentTestid + '-' + get(r, nameField)"
:class="{
'has-description': !!get(r, descriptionField),
'has-side-label': !!get(r, sideLabelField), [colorFor(r, idx)]: true, disabled: get(r, disabledField) === true
'has-side-label': !!get(r, sideLabelField),
[colorFor(r, idx)]: true,
disabled: get(r, disabledField) === true
}"
@click="select(r, idx)"
@keyup.enter.space="select(r, idx)"
>
<div
class="side-label"
Expand Down Expand Up @@ -212,6 +219,10 @@ export default {
text-decoration: none !important;
color: $color;
&:focus-visible {
@include focus-outline;
}
&:hover:not(.disabled) {
box-shadow: 0 0 30px var(--shadow);
transition: box-shadow 0.1s ease-in-out;
Expand Down
4 changes: 4 additions & 0 deletions shell/pages/c/_cluster/apps/charts/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ export default {
class="input-sm"
:placeholder="t('catalog.charts.search')"
data-testid="charts-filter-input"
:aria-label="t('catalog.charts.search')"
role="textbox"
>

<button
Expand All @@ -463,6 +465,8 @@ export default {
@shortkey="focusSearch()"
/>
<AsyncButton
role="button"
:aria-label="t('catalog.charts.refresh')"
class="refresh-btn"
mode="refresh"
size="sm"
Expand Down

0 comments on commit 3b0418f

Please sign in to comment.