Skip to content

Commit

Permalink
Set disabled items to use disabled property (#7342)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
charlesh88 and unlikelyzero authored Jan 26, 2024
1 parent b9df97e commit 1fc6056
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/api/menu/components/MenuComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
v-for="action in actionGroups"
:key="action.name"
role="menuitem"
:class="[action.cssClass, action.isDisabled ? 'disabled' : '']"
:aria-disabled="action.isDisabled"
:class="action.cssClass"
:aria-label="action.name"
:title="action.description"
@click="action.onItemClicked"
Expand All @@ -51,7 +52,8 @@
v-for="action in options.actions"
:key="action.name"
role="menuitem"
:class="[action.cssClass, action.isDisabled ? 'disabled' : '']"
:aria-disabled="action.isDisabled"
:class="action.cssClass"
:aria-label="action.name"
:title="action.description"
@click="action.onItemClicked"
Expand Down
3 changes: 2 additions & 1 deletion src/api/menu/components/SuperMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
v-for="action in actionGroups"
:key="action.name"
role="menuitem"
:class="[action.cssClass, action.isDisabled ? 'disabled' : '']"
:aria-disabled="action.isDisabled"
:class="action.cssClass"
:title="action.description"
@click="action.onItemClicked"
@mouseover="toggleItemDescription(action)"
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/notebook/components/NotebookComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
</div>
<div
v-if="selectedPage && !selectedPage.isLocked"
:class="{ disabled: activeTransaction }"
:aria-disabled="activeTransaction"
class="c-notebook__drag-area icon-plus"
@click="newEntry(null, $event)"
@dragover="dragOver"
Expand Down
3 changes: 2 additions & 1 deletion src/styles/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -360,11 +360,12 @@ body.desktop .has-local-controls {
}
}

[aria-disabled = 'true'],
*[disabled],
.disabled {
opacity: $controlDisabledOpacity;
cursor: not-allowed !important;
pointer-events: none !important;
cursor: default !important;
}

/******************************************************** RESPONSIVE CONTAINERS */
Expand Down
11 changes: 11 additions & 0 deletions src/ui/layout/CreateButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<div ref="createButton" class="c-create-button--w">
<button
class="c-create-button c-button--menu c-button--major icon-plus"
:aria-disabled="isEditing"
@click.prevent.stop="showCreateMenu"
>
<span class="c-button__label">Create</span>
Expand All @@ -38,6 +39,7 @@ export default {
data: function () {
return {
menuItems: {},
isEditing: this.openmct.editor.isEditing(),
selectedMenuItem: {},
opened: false
};
Expand All @@ -57,6 +59,12 @@ export default {
});
}
},
mounted() {
this.openmct.editor.on('isEditing', this.toggleEdit);
},
unmounted() {
this.openmct.editor.off('isEditing', this.toggleEdit);
},
methods: {
getItems() {
let keys = this.openmct.types.listKeys();
Expand Down Expand Up @@ -89,6 +97,9 @@ export default {

this.openmct.menus.showSuperMenu(x, y, this.sortedItems, menuOptions);
},
toggleEdit(isEditing) {
this.isEditing = isEditing;
},
create(key) {
const createAction = new CreateAction(this.openmct, key, this.openmct.router.path[0]);

Expand Down
4 changes: 0 additions & 4 deletions src/ui/layout/create-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
}

.c-create-button {
.is-editing & {
@include disabled();
}

.c-button__label {
text-transform: $createBtnTextTransform;
}
Expand Down
2 changes: 0 additions & 2 deletions src/ui/layout/mct-tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,6 @@

.is-editing .is-navigated-object {
a[class*='__item__label'] {
opacity: 0.4;

[class*='__name'] {
font-style: italic;
}
Expand Down

0 comments on commit 1fc6056

Please sign in to comment.