-
Notifications
You must be signed in to change notification settings - Fork 205
feat(design-system, web-pkg): add explicit explanation to enable/disable sync functionality to avoid confusing the user #13486
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,16 @@ | ||
| <template> | ||
| <li v-oc-tooltip="componentProps.disabled ? action.disabledTooltip?.(actionOptions) : ''"> | ||
| <oc-button | ||
| v-oc-tooltip="showTooltip || action.hideLabel ? action.label(actionOptions) : ''" | ||
| v-oc-tooltip="showTooltip || action.hideLabel ? tooltipText : ''" | ||
| :type="componentType" | ||
| v-bind="componentProps" | ||
| :class="[action.class, 'action-menu-item', 'oc-py-s', 'oc-px-m', 'oc-width-1-1']" | ||
| :aria-label="ariaLabel" | ||
| data-testid="action-handler" | ||
| :size="size" | ||
| justify-content="left" | ||
| :title="action.label(actionOptions)" | ||
| :title="tooltipText" | ||
| :aria-describedby="uniqueId" | ||
| v-on="componentListeners" | ||
| > | ||
| <oc-img | ||
|
|
@@ -51,11 +52,14 @@ | |
| v-text="action.shortcut" | ||
| /> | ||
| </oc-button> | ||
| <span :id="uniqueId" class="oc-invisible-sr"> | ||
| {{ tooltipText }} | ||
| </span> | ||
| </li> | ||
| </template> | ||
|
|
||
| <script lang="ts" setup> | ||
| import { computed, unref } from 'vue' | ||
| import { computed, unref, useId } from 'vue' | ||
| import { Action, ActionOptions, useConfigStore } from '../../composables' | ||
| import { useGettext } from 'vue3-gettext' | ||
| import { storeToRefs } from 'pinia' | ||
|
|
@@ -98,6 +102,16 @@ const componentType = computed<string>(() => { | |
| return 'button' | ||
| }) | ||
|
|
||
| const uniqueId = useId() | ||
|
|
||
| const tooltipText = computed<string>(() => { | ||
| if (action?.tooltip) { | ||
| return `${action.label(actionOptions)} - ${action.tooltip(actionOptions)}` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder whether we need to include the action label here or if we can rely only on the tooltip... |
||
| } | ||
|
|
||
| return action.label(actionOptions) | ||
| }) | ||
|
|
||
| const ariaLabel = computed<string | null>(() => { | ||
| if (componentProps.value.disabled && action.disabledTooltip) { | ||
| return action.disabledTooltip(actionOptions) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ import { useMessages, useConfigStore, useResourcesStore } from '../../piniaStore | |
| export const useFileActionsEnableSync = () => { | ||
| const { showMessage, showErrorMessage } = useMessages() | ||
| const router = useRouter() | ||
| const { $gettext, $ngettext } = useGettext() | ||
| const { $gettext, $ngettext, $pgettext } = useGettext() | ||
|
|
||
| const clientService = useClientService() | ||
| const loadingService = useLoadingService() | ||
|
|
@@ -82,6 +82,11 @@ export const useFileActionsEnableSync = () => { | |
| name: 'enable-sync', | ||
| icon: 'check', | ||
| handler: (args) => loadingService.addTask(() => handler(args)), | ||
| tooltip: () => | ||
| $pgettext( | ||
| 'Explanation tooltip for the enable sync action in files shared with me and spaces', | ||
| 'Only affects desktop and mobile clients. You can toggle this setting here, but it will only take effect on those platforms.' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Best to check with @DeepDiver1975 whether mobile clients are really affected or if it's only desktop...
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What would you say about being a bit more explicite what the settings actually do? Then maybe the mention that it does not affect web client might be redundant because it might be clear enough from the functionality description. |
||
| ), | ||
| label: () => $gettext('Enable sync'), | ||
| isVisible: ({ space, resources }) => { | ||
| if ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this result in the action label being read twice in case there is no custom tooltip?