Skip to content

Commit

Permalink
Add keyboard modality support for UiMenuOption and so works
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellamaki committed May 12, 2022
1 parent 4d794ce commit 2361a84
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/keen/UiMenuOption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
<component
:is="isAnchor ? 'a' : 'li'"
class="ui-menu-option"

supports-modality=keyboard
@focus="isActive = true"
@blur="isActive = false"
role="menu-item"
:class="classes"
:style="activeStyle"
:href="isAnchor ? (disabled ? null : href) : null"
:tabindex="(isDivider || isAnchor || disabled) ? null : '0'"
:target="isAnchor ? (disabled ? null : target) : null"
Expand Down Expand Up @@ -41,6 +44,8 @@
<script>
import UiIcon from './UiIcon.vue';
import globalThemeState from '../styles/globalThemeState';
export default {
name: 'UiMenuOption',
Expand All @@ -49,6 +54,10 @@
UiIcon,
},
data:() => ({
isActive: false,
}),
props: {
type: String,
label: String,
Expand Down Expand Up @@ -77,6 +86,9 @@
};
},
activeStyle() {
return this.isActive ? {...this.$coreOutline, outlineOffset: '-2px' } : {}
},
isDivider() {
return this.type === 'divider';
},
Expand Down

0 comments on commit 2361a84

Please sign in to comment.