Skip to content

Commit

Permalink
Add disabled state to actions
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
  • Loading branch information
marcoambrosini committed Feb 24, 2021
1 parent 6e4db7f commit 0201cb4
Showing 1 changed file with 16 additions and 0 deletions.
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

0 comments on commit 0201cb4

Please sign in to comment.