@@ -136,7 +137,7 @@ export default {
@@ -193,6 +194,8 @@ export default {
type="button"
class="btn role-primary"
data-testid="import-yaml-close"
+ role="button"
+ :aria-label="t('generic.close')"
@click="close"
>
{{ t('generic.close') }}
@@ -207,6 +210,8 @@ export default {
type="button"
class="btn role-secondary mr-10"
data-testid="import-yaml-cancel"
+ role="button"
+ :aria-label="t('generic.cancel')"
@click="close"
>
{{ t('generic.cancel') }}
@@ -216,6 +221,8 @@ export default {
mode="import"
:disabled="!currentYaml.length"
data-testid="import-yaml-import-action"
+ role="button"
+ :aria-label="t('import.title')"
@click="importYaml"
/>
diff --git a/shell/components/YamlEditor.vue b/shell/components/YamlEditor.vue
index 4d2d0a0da25..0c10f934ec4 100644
--- a/shell/components/YamlEditor.vue
+++ b/shell/components/YamlEditor.vue
@@ -147,7 +147,6 @@ export default {
return [EDITOR_MODES.EDIT_CODE, EDITOR_MODES.VIEW_CODE].includes(this.editorMode);
},
},
-
watch: {
showUploadPrompt(neu) {
if (neu) {
@@ -156,10 +155,31 @@ export default {
},
},
+ mounted() {
+ document.addEventListener('keydown', this.handleEscapeKey);
+ },
+ beforeUnmount() {
+ document.removeEventListener('keydown', this.handleEscapeKey);
+ },
+
methods: {
- focus() {
- if ( this.$refs.cm ) {
- this.$refs.cm.focus();
+ // focus() {
+ // if ( this.$refs.cm ) {
+ // this.$refs.cm.focus();
+ // }
+ // },
+
+ handleEscapeKey(e) {
+ if (e.key === 'Escape') {
+ console.log('******* document.activeElement ON YAML EDITOR ********', document.activeElement);
+
+ const yamlEditorEl = this.$refs.cm.$el;
+ const currActiveEl = document.activeElement;
+
+ if (yamlEditorEl.contains(currActiveEl)) {
+ console.warn('MOVING FOCUS TO OUTER ELEMENT!');
+ this.$refs.outerYamlEditorElement.focus();
+ }
}
},
@@ -204,7 +224,10 @@ export default {