Skip to content

Commit

Permalink
fix keyboard nav on settings list page + settings edit page (#13123)
Browse files Browse the repository at this point in the history
  • Loading branch information
aalves08 authored Jan 23, 2025
1 parent 6e35eca commit c6db1b7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 23 deletions.
2 changes: 2 additions & 0 deletions shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7432,6 +7432,8 @@ registryConfig:
##############################

advancedSettings:
setEnv: Set by Environment Variable
hideShow: Hide/show setting
label: Settings
subtext: Typical users will not need to change these. Proceed with caution, incorrect values can break your {appName} installation. Settings which have been customized from default settings are tagged 'Modified'.
show: Show
Expand Down
15 changes: 11 additions & 4 deletions shell/components/ResourceDetail/Masthead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,9 @@ export default {
<router-link
v-if="location"
:to="location"
role="link"
class="masthead-resource-list-link"
:aria-label="parent.displayName"
>
{{ parent.displayName }}:
</router-link>
Expand Down Expand Up @@ -584,10 +587,10 @@ export default {
}
HEADER {
margin: 0;
margin: 0 0 0 -5px;
.title {
overflow: hidden;
overflow-x: hidden;
}
}
Expand All @@ -598,17 +601,21 @@ export default {
h1 {
margin: 0;
overflow: hidden;
overflow-x: hidden;
display: flex;
flex-direction: row;
align-items: center;
.masthead-resource-title {
padding: 0 8px;
text-overflow: ellipsis;
overflow: hidden;
overflow-x: hidden;
white-space: nowrap;
}
.masthead-resource-list-link {
margin: 5px;
}
}
}
Expand Down
49 changes: 30 additions & 19 deletions shell/list/management.cattle.io.setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,31 @@ export default {
return { settings: null };
},
computed: { ...mapGetters({ t: 'i18n/t' }) },
computed: {
...mapGetters({ t: 'i18n/t' }),
...mapGetters({
// Use either these Vuex getters
// OR the props to set the action menu state,
// but don't use both.
targetElem: 'action-menu/elem',
shouldShow: 'action-menu/showing',
}),
},
methods: {
showActionMenu(e, setting) {
toggleActionMenu(e, setting) {
const actionElement = e.srcElement;
this.$store.commit(`action-menu/show`, {
resources: setting.data,
elem: actionElement
});
if (!this.targetElem && !this.shouldShow) {
this.$store.commit(`action-menu/show`, {
resources: setting.data,
elem: actionElement
});
} else if (this.targetElem === actionElement && this.shouldShow) {
// this condition is needed so that we can "toggle" the action menu with
// the keyboard for accessibility (row action menu)
this.$store.commit('action-menu/hide');
}
},
}
};
Expand Down Expand Up @@ -101,7 +116,7 @@ export default {
<span
v-if="setting.fromEnv"
class="modified"
>Set by Environment Variable</span>
>{{ t('advancedSettings.setEnv') }}</span>
<span
v-else-if="setting.customized"
class="modified"
Expand All @@ -118,23 +133,27 @@ export default {
aria-expanded="false"
type="button"
class="btn btn-sm role-multi-action actions"
@click="showActionMenu($event, setting)"
role="button"
:aria-label="t('advancedSettings.edit.label')"
@click="toggleActionMenu($event, setting)"
>
<i class="icon icon-actions" />
</button>
</div>
</div>
<div value>
<div v-if="setting.hide">
<div v-if="setting.canHide">
<button
class="btn btn-sm role-primary"
role="button"
:aria-label="t('advancedSettings.hideShow')"
@click="setting.hide = !setting.hide"
>
{{ t('advancedSettings.show') }} {{ setting.id }}
{{ setting.hide ? t('advancedSettings.show') : t('advancedSettings.hide') }} {{ setting.id }}
</button>
</div>
<div
v-else
v-show="!setting.canHide || (setting.canHide && !setting.hide)"
class="settings-value"
>
<pre v-if="setting.kind === 'json'">{{ setting.json }}</pre>
Expand All @@ -146,14 +165,6 @@ export default {
class="text-muted"
>&lt;{{ t('advancedSettings.none') }}&gt;</pre>
</div>
<div v-if="setting.canHide && !setting.hide">
<button
class="btn btn-sm role-primary"
@click="setting.hide = !setting.hide"
>
{{ t('advancedSettings.hide') }} {{ setting.id }}
</button>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit c6db1b7

Please sign in to comment.