From f27fbbdc158696ca3627c448b2c8aef74577317d Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Thu, 8 Aug 2024 11:24:58 +0200 Subject: [PATCH] fix: keyboard actions for deactivated resources Prevents actions for disabled resources from being accessible via keyboard navigation. This is achieved by either disabling them (checkboxes) or hiding them (rename action, quick actions). --- ...ix-keyboard-actions-for-disabled-resources | 6 +++ .../OcStatusIndicators.spec.ts | 13 ++++++ .../OcStatusIndicators/OcStatusIndicators.vue | 9 +++- .../src/helpers/resource/functions.ts | 2 +- .../components/FilesList/ResourceTable.vue | 5 ++- .../components/FilesList/ResourceTiles.vue | 6 +++ .../actions/files/useFileActionsRename.ts | 2 +- .../FilesList/ResourceTable.spec.ts | 44 ++++++++++++++----- .../FilesList/ResourceTiles.spec.ts | 34 +++++++++++++- 9 files changed, 106 insertions(+), 15 deletions(-) create mode 100644 changelog/unreleased/bugfix-keyboard-actions-for-disabled-resources diff --git a/changelog/unreleased/bugfix-keyboard-actions-for-disabled-resources b/changelog/unreleased/bugfix-keyboard-actions-for-disabled-resources new file mode 100644 index 00000000000..9490406006b --- /dev/null +++ b/changelog/unreleased/bugfix-keyboard-actions-for-disabled-resources @@ -0,0 +1,6 @@ +Bugfix: Keyboard actions for disabled resources + +We've fixed an issue where certain actions such as rename or select were still possible for disabled resources when navigating via keyboard. + +https://github.com/owncloud/web/pull/11342 +https://github.com/owncloud/web/issues/11335 diff --git a/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.spec.ts b/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.spec.ts index 4a2bd64fb98..71a796c1b7f 100644 --- a/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.spec.ts +++ b/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.spec.ts @@ -46,4 +46,17 @@ describe('OcStatusIndicators', () => { }) expect(wrapper.find(`#${indicator.id}`).exists()).toBeTruthy() }) + it('does not render a button if disableHandler is set', () => { + const wrapper = mount(StatusIndicators, { + props: { + resource: fileResource, + indicators: [indicator], + disableHandler: true + }, + global: { + plugins: [...defaultPlugins()] + } + }) + expect(wrapper.find('button').exists()).toBeFalsy() + }) }) diff --git a/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.vue b/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.vue index 921886d4d0b..cc167724915 100644 --- a/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.vue +++ b/packages/design-system/src/components/OcStatusIndicators/OcStatusIndicators.vue @@ -2,7 +2,7 @@