Skip to content

Commit

Permalink
Add close button and trigger close on route change
Browse files Browse the repository at this point in the history
Adjusted aria-label
  • Loading branch information
Lukas Hirt committed Oct 8, 2019
1 parent 3c79bc4 commit 2f60d78
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions apps/files/src/components/FileActions.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<template>
<div v-if="isOpen" :id="id" uk-offcanvas="mode: slide" class="oc-file-actions uk-offcanvas-bottom uk-open" style="display: block !important;">
<div class="uk-offcanvas-bar">
<span v-text="_label"></span>
<oc-button
icon="close"
class="uk-position-top-right uk-position-absolute uk-margin-top uk-margin-right"
@click="closeActions"
aria-label="$_closeActionsButtonLabel"
/>
<div v-text="$_label" class="uk-margin-small-bottom" />
<ul class="uk-nav">
<li v-for="(action, i) in actions" :key="i">
<a class="uk-inline" @click="selectAction(action)">
Expand Down Expand Up @@ -30,6 +36,21 @@ export default {
isOpen: false
}
},
computed: {
$_label () {
const translated = this.$gettext('Open %{fileName} in')
return this.$gettextInterpolate(translated, { fileName: this.filename })
},
$_closeActionsButtonLabel () {
return this.$gettext('Close file actions menu')
}
},
watch: {
$route () {
this.closeActions()
}
},
mounted () {
this.$root.$on('oc-file-actions:open', file => {
this.showActions(file)
Expand All @@ -50,12 +71,6 @@ export default {
this.closeActions()
action.onClick()
}
},
computed: {
_label () {
const translated = this.$gettext('Open %{fileName} in')
return this.$gettextInterpolate(translated, { fileName: this.filename })
}
}
}
</script>

0 comments on commit 2f60d78

Please sign in to comment.