|
55 | 55 | @pointerdown="trackPress('cards', summary.key, $event)" |
56 | 56 | @mouseup="markSelectionGesture('cards', summary.key)" |
57 | 57 | @click="openSettingFromPointer('cards', summary.key, $event)" |
58 | | - @keydown.enter.prevent="state.openSetting(summary.key)" |
59 | | - @keydown.space.prevent="state.openSetting(summary.key)"> |
| 58 | + @keydown.enter.prevent="openSettingFromKeyboard(summary.key)" |
| 59 | + @keydown.space.prevent="openSettingFromKeyboard(summary.key)"> |
60 | 60 | <div class="policy-workbench__setting-body"> |
61 | 61 | <div class="policy-workbench__setting-header"> |
62 | 62 | <div> |
|
85 | 85 | </div> |
86 | 86 |
|
87 | 87 | <div class="policy-workbench__setting-footer"> |
88 | | - <NcButton variant="secondary" class="policy-workbench__manage-button" :aria-label="t('libresign', 'Configure setting')" @click.stop="state.openSetting(summary.key)"> |
| 88 | + <NcButton variant="secondary" class="policy-workbench__manage-button" :aria-label="t('libresign', 'Configure setting')" @click.stop="openSettingFromAction(summary.key, $event)"> |
89 | 89 | {{ t('libresign', 'Configure') }} |
90 | 90 | </NcButton> |
91 | 91 | </div> |
|
102 | 102 | @pointerdown="trackPress('list', summary.key, $event)" |
103 | 103 | @mouseup="markSelectionGesture('list', summary.key)" |
104 | 104 | @click="openSettingFromPointer('list', summary.key, $event)" |
105 | | - @keydown.enter.prevent="state.openSetting(summary.key)" |
106 | | - @keydown.space.prevent="state.openSetting(summary.key)"> |
| 105 | + @keydown.enter.prevent="openSettingFromKeyboard(summary.key)" |
| 106 | + @keydown.space.prevent="openSettingFromKeyboard(summary.key)"> |
107 | 107 | <div class="policy-workbench__settings-row-main"> |
108 | 108 | <h3 class="policy-workbench__setting-title"> |
109 | 109 | <span v-html="highlightText(summary.title)"></span> |
|
123 | 123 | <span class="policy-workbench__settings-row-stat policy-workbench__settings-row-stat--count"><strong>{{ t('libresign', 'Custom rules') }}:</strong> {{ formatOverrideSummary(summary.groupCount, summary.userCount) }}</span> |
124 | 124 | </div> |
125 | 125 |
|
126 | | - <NcButton variant="secondary" class="policy-workbench__manage-button" :aria-label="t('libresign', 'Configure setting')" @click.stop="state.openSetting(summary.key)"> |
| 126 | + <NcButton variant="secondary" class="policy-workbench__manage-button" :aria-label="t('libresign', 'Configure setting')" @click.stop="openSettingFromAction(summary.key, $event)"> |
127 | 127 | {{ t('libresign', 'Configure') }} |
128 | 128 | </NcButton> |
129 | 129 | </article> |
@@ -446,6 +446,7 @@ const removalFeedback = ref<string | null>(null) |
446 | 446 | const removalFeedbackTimeout = ref<number | null>(null) |
447 | 447 | const lastPress = ref<{ surface: 'cards' | 'list', key: string, x: number, y: number } | null>(null) |
448 | 448 | const recentSelectionGesture = ref<{ surface: 'cards' | 'list', key: string, at: number } | null>(null) |
| 449 | +const clearCatalogFocusOnClose = ref(false) |
449 | 450 | const openRuleActionsKey = ref<string | null>(null) |
450 | 451 | const crudSearch = ref('') |
451 | 452 | const crudScopeFilter = ref<'all' | 'system' | 'group' | 'user'>('all') |
@@ -1006,6 +1007,17 @@ function openSettingFromPointer(surface: 'cards' | 'list', key: string, event: M |
1006 | 1007 | return |
1007 | 1008 | } |
1008 | 1009 |
|
| 1010 | + clearCatalogFocusOnClose.value = true |
| 1011 | + state.openSetting(key as never) |
| 1012 | +} |
| 1013 | +
|
| 1014 | +function openSettingFromAction(key: string, event: MouseEvent) { |
| 1015 | + clearCatalogFocusOnClose.value = event.detail > 0 |
| 1016 | + state.openSetting(key as never) |
| 1017 | +} |
| 1018 | +
|
| 1019 | +function openSettingFromKeyboard(key: string) { |
| 1020 | + clearCatalogFocusOnClose.value = false |
1009 | 1021 | state.openSetting(key as never) |
1010 | 1022 | } |
1011 | 1023 |
|
@@ -1158,6 +1170,15 @@ function confirmDiscardDialog() { |
1158 | 1170 |
|
1159 | 1171 | if (action === 'close-setting') { |
1160 | 1172 | state.closeSetting() |
| 1173 | + if (clearCatalogFocusOnClose.value) { |
| 1174 | + void nextTick().then(() => { |
| 1175 | + const activeElement = document.activeElement |
| 1176 | + if (activeElement instanceof HTMLElement) { |
| 1177 | + activeElement.blur() |
| 1178 | + } |
| 1179 | + }) |
| 1180 | + } |
| 1181 | + clearCatalogFocusOnClose.value = false |
1161 | 1182 | } |
1162 | 1183 |
|
1163 | 1184 | openRuleActionsKey.value = null |
@@ -1240,6 +1261,15 @@ function requestCloseSetting() { |
1240 | 1261 | } |
1241 | 1262 |
|
1242 | 1263 | state.closeSetting() |
| 1264 | + if (clearCatalogFocusOnClose.value) { |
| 1265 | + void nextTick().then(() => { |
| 1266 | + const activeElement = document.activeElement |
| 1267 | + if (activeElement instanceof HTMLElement) { |
| 1268 | + activeElement.blur() |
| 1269 | + } |
| 1270 | + }) |
| 1271 | + } |
| 1272 | + clearCatalogFocusOnClose.value = false |
1243 | 1273 | } |
1244 | 1274 |
|
1245 | 1275 | onMounted(async () => { |
|
0 commit comments