Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set disabled items to use disabled property #7342

Merged
merged 8 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
:title="action.description"
@click="action.onItemClicked"
>
Expand All @@ -50,7 +51,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"
: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 @@
data: function () {
return {
menuItems: {},
isEditing: this.openmct.editor.isEditing(),
selectedMenuItem: {},
opened: false
};
Expand All @@ -57,6 +59,12 @@
});
}
},
mounted() {
this.openmct.editor.on('isEditing', this.toggleEdit);
},
unmounted() {

Check warning on line 65 in src/ui/layout/CreateButton.vue

View check run for this annotation

Codecov / codecov/patch

src/ui/layout/CreateButton.vue#L65

Added line #L65 was not covered by tests
this.openmct.editor.off('isEditing', this.toggleEdit);
},
methods: {
getItems() {
let keys = this.openmct.types.listKeys();
Expand Down Expand Up @@ -89,6 +97,9 @@

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
Loading