Set disabled items to use disabled property (#7342)

* Closes #7322
- New CSS for `aria-disabled = true` property.
- Changed multiple items to use aria-disabled instead of .disabled, including:
  - Action menu
  - Super menu
  - Notebook drag area
- Tree item style modded to only italicize when is-navigated and is being edited.

* Closes #7322
- New CSS for `aria-disabled = true` property.
- Changed multiple items to use aria-disabled instead of .disabled, including:
  - Action menu
  - Super menu
  - Notebook drag area
- Tree item style modded to only italicize when is-navigated and is being edited.
- Create button sets itself to `disabled` when the editor is in use.

* Closes #7322
- Create button now _actually_ sets itself to `aria-disabled` when the editor is in use.
- CSS removes selector for `.is-editing`.

* fix conflict

---------

Co-authored-by: John Hill <john.c.hill@nasa.gov>
This commit is contained in:
Charles Hacskaylo 2024-01-26 14:55:13 -08:00 committed by GitHub
parent b9df97e2bc
commit 1fc6056c51
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 20 additions and 11 deletions

View File

@ -28,7 +28,8 @@
v-for="action in actionGroups" v-for="action in actionGroups"
:key="action.name" :key="action.name"
role="menuitem" role="menuitem"
:class="[action.cssClass, action.isDisabled ? 'disabled' : '']" :aria-disabled="action.isDisabled"
:class="action.cssClass"
:aria-label="action.name" :aria-label="action.name"
:title="action.description" :title="action.description"
@click="action.onItemClicked" @click="action.onItemClicked"
@ -51,7 +52,8 @@
v-for="action in options.actions" v-for="action in options.actions"
:key="action.name" :key="action.name"
role="menuitem" role="menuitem"
:class="[action.cssClass, action.isDisabled ? 'disabled' : '']" :aria-disabled="action.isDisabled"
:class="action.cssClass"
:aria-label="action.name" :aria-label="action.name"
:title="action.description" :title="action.description"
@click="action.onItemClicked" @click="action.onItemClicked"

View File

@ -37,7 +37,8 @@
v-for="action in actionGroups" v-for="action in actionGroups"
:key="action.name" :key="action.name"
role="menuitem" role="menuitem"
:class="[action.cssClass, action.isDisabled ? 'disabled' : '']" :aria-disabled="action.isDisabled"
:class="action.cssClass"
:title="action.description" :title="action.description"
@click="action.onItemClicked" @click="action.onItemClicked"
@mouseover="toggleItemDescription(action)" @mouseover="toggleItemDescription(action)"

View File

@ -96,7 +96,7 @@
</div> </div>
<div <div
v-if="selectedPage && !selectedPage.isLocked" v-if="selectedPage && !selectedPage.isLocked"
:class="{ disabled: activeTransaction }" :aria-disabled="activeTransaction"
class="c-notebook__drag-area icon-plus" class="c-notebook__drag-area icon-plus"
@click="newEntry(null, $event)" @click="newEntry(null, $event)"
@dragover="dragOver" @dragover="dragOver"

View File

@ -360,11 +360,12 @@ body.desktop .has-local-controls {
} }
} }
[aria-disabled = 'true'],
*[disabled], *[disabled],
.disabled { .disabled {
opacity: $controlDisabledOpacity; opacity: $controlDisabledOpacity;
cursor: not-allowed !important;
pointer-events: none !important; pointer-events: none !important;
cursor: default !important;
} }
/******************************************************** RESPONSIVE CONTAINERS */ /******************************************************** RESPONSIVE CONTAINERS */

View File

@ -23,6 +23,7 @@
<div ref="createButton" class="c-create-button--w"> <div ref="createButton" class="c-create-button--w">
<button <button
class="c-create-button c-button--menu c-button--major icon-plus" class="c-create-button c-button--menu c-button--major icon-plus"
:aria-disabled="isEditing"
@click.prevent.stop="showCreateMenu" @click.prevent.stop="showCreateMenu"
> >
<span class="c-button__label">Create</span> <span class="c-button__label">Create</span>
@ -38,6 +39,7 @@ export default {
data: function () { data: function () {
return { return {
menuItems: {}, menuItems: {},
isEditing: this.openmct.editor.isEditing(),
selectedMenuItem: {}, selectedMenuItem: {},
opened: false opened: false
}; };
@ -57,6 +59,12 @@ export default {
}); });
} }
}, },
mounted() {
this.openmct.editor.on('isEditing', this.toggleEdit);
},
unmounted() {
this.openmct.editor.off('isEditing', this.toggleEdit);
},
methods: { methods: {
getItems() { getItems() {
let keys = this.openmct.types.listKeys(); let keys = this.openmct.types.listKeys();
@ -89,6 +97,9 @@ export default {
this.openmct.menus.showSuperMenu(x, y, this.sortedItems, menuOptions); this.openmct.menus.showSuperMenu(x, y, this.sortedItems, menuOptions);
}, },
toggleEdit(isEditing) {
this.isEditing = isEditing;
},
create(key) { create(key) {
const createAction = new CreateAction(this.openmct, key, this.openmct.router.path[0]); const createAction = new CreateAction(this.openmct, key, this.openmct.router.path[0]);

View File

@ -4,10 +4,6 @@
} }
.c-create-button { .c-create-button {
.is-editing & {
@include disabled();
}
.c-button__label { .c-button__label {
text-transform: $createBtnTextTransform; text-transform: $createBtnTextTransform;
} }

View File

@ -203,8 +203,6 @@
.is-editing .is-navigated-object { .is-editing .is-navigated-object {
a[class*='__item__label'] { a[class*='__item__label'] {
opacity: 0.4;
[class*='__name'] { [class*='__name'] {
font-style: italic; font-style: italic;
} }