aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-01-09 19:43:58 +0100
committerGitHub <noreply@github.com>2024-01-09 19:43:58 +0100
commit6daa77b93f4a9d87a376ed7f10aaa486de4cc1f6 (patch)
tree6005e8613653ef39bb48ebf97ead1335322603a5 /core
parentd72db91785174ad19b0057264506f24cfc03494c (diff)
parent707c1c0b0b236b3f6c5467e05b5fb2284898d957 (diff)
downloadnextcloud-server-6daa77b93f4a9d87a376ed7f10aaa486de4cc1f6.tar.gz
nextcloud-server-6daa77b93f4a9d87a376ed7f10aaa486de4cc1f6.zip
Merge pull request #42636 from nextcloud/fix/core/42596/fix-button-accessibility-in-view-profile-page
enh(core): replaced previous native a element with NcButton
Diffstat (limited to 'core')
-rw-r--r--core/src/components/Profile/PrimaryActionButton.vue70
1 files changed, 24 insertions, 46 deletions
diff --git a/core/src/components/Profile/PrimaryActionButton.vue b/core/src/components/Profile/PrimaryActionButton.vue
index dcd28e0c3a1..d09b348c62b 100644
--- a/core/src/components/Profile/PrimaryActionButton.vue
+++ b/core/src/components/Profile/PrimaryActionButton.vue
@@ -21,23 +21,33 @@
-->
<template>
- <a class="profile__primary-action-button"
- :class="{ 'disabled': disabled }"
+ <NcButton type="primary"
:href="href"
+ alignment="center"
:target="target"
- rel="noopener noreferrer nofollow"
- v-on="$listeners">
- <img class="icon"
- :class="[icon, { 'icon-invert': colorPrimaryText === '#ffffff' }]"
- :src="icon">
+ :disabled="disabled">
+ <template #icon>
+ <img class="icon"
+ aria-hidden="true"
+ :src="icon"
+ alt="">
+ </template>
<slot />
- </a>
+ </NcButton>
</template>
<script>
-export default {
+import { defineComponent } from 'vue'
+import { NcButton } from '@nextcloud/vue'
+import { translate as t } from '@nextcloud/l10n'
+
+export default defineComponent({
name: 'PrimaryActionButton',
+ components: {
+ NcButton,
+ },
+
props: {
disabled: {
type: Boolean,
@@ -58,46 +68,14 @@ export default {
},
},
- computed: {
- colorPrimaryText() {
- // For some reason the returned string has prepended whitespace
- return getComputedStyle(document.body).getPropertyValue('--color-primary-element-text').trim()
- },
+ methods: {
+ t,
},
-}
+})
</script>
<style lang="scss" scoped>
- .profile__primary-action-button {
- font-size: var(--default-font-size);
- font-weight: bold;
- width: 188px;
- height: 44px;
- padding: 0 16px;
- line-height: 44px;
- text-align: center;
- border-radius: var(--border-radius-pill);
- color: var(--color-primary-element-text);
- background-color: var(--color-primary-element);
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-
- .icon {
- display: inline-block;
- vertical-align: middle;
- margin-bottom: 2px;
- margin-right: 4px;
-
- &.icon-invert {
- filter: invert(1);
- }
- }
-
- &:hover,
- &:focus,
- &:active {
- background-color: var(--color-primary-element-light);
- }
+ .icon {
+ filter: var(--primary-invert-if-dark);
}
</style>