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

Add disabled state to actions #1724

Merged
merged 1 commit into from
Feb 24, 2021
Merged
Changes from all 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
16 changes: 16 additions & 0 deletions src/components/Actions/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-action
:class="[firstAction.icon, firstActionClass]"
class="action-item action-item--single"
rel="noreferrer noopener"
:disabled="disabled"
@[firstActionEventBinding]="execFirstAction">
<!-- fake slot to gather main action -->
<span :aria-hidden="true" hidden>
Expand Down Expand Up @@ -125,6 +126,7 @@ https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-action
<!-- Menu open/close trigger button -->
<button slot="trigger"
ref="menuButton"
:disabled="disabled"
class="icon action-item__menutoggle"
:class="{
[defaultIcon]: true,
Expand Down Expand Up @@ -278,6 +280,14 @@ export default {
type: String,
default: 'body',
},

/**
* Disabled state of the main button (single action or menu toggle)
*/
disabled: {
type: Boolean,
default: false,
},
},

data() {
Expand Down Expand Up @@ -586,6 +596,12 @@ export default {
background-color: $icon-focus-bg;
}

// TODO: handle this in the future button component
&__menutoggle:disabled,
&--single:disabled {
opacity: .3 !important;
}

&.action-item--open .action-item__menutoggle {
opacity: $opacity_full;
background-color: $action-background-hover;
Expand Down