mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix: focus goes outside modals with tab key navigation
This commit is contained in:
@ -5,6 +5,7 @@
|
||||
tabindex="0"
|
||||
:style="{'height': resultsSize+'px'}"
|
||||
@blur="deselectRows"
|
||||
@focus="hasFocus = true"
|
||||
@keyup.delete="showDeleteConfirmModal"
|
||||
@keydown.esc="deselectRows"
|
||||
>
|
||||
@ -152,6 +153,7 @@ const resultsSize = ref(0);
|
||||
const localResults: Ref<QueryResult<any>[]> = ref([]);
|
||||
const isContext = ref(false);
|
||||
const isDeleteConfirmModal = ref(false);
|
||||
const hasFocus = ref(false);
|
||||
const contextEvent = ref(null);
|
||||
const selectedCell = ref(null);
|
||||
const selectedRows = ref([]);
|
||||
@ -455,6 +457,7 @@ const deselectRows = () => {
|
||||
if (!isEditingRow.value) {
|
||||
selectedRows.value = [];
|
||||
selectedField.value = null;
|
||||
hasFocus.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
@ -519,6 +522,9 @@ const onKey = async (e: KeyboardEvent) => {
|
||||
if (!props.isSelected)
|
||||
return;
|
||||
|
||||
if (!hasFocus.value)
|
||||
return;
|
||||
|
||||
if (isEditingRow.value)
|
||||
return;
|
||||
|
||||
@ -626,7 +632,13 @@ const scrollToCell = (el: HTMLElement) => {
|
||||
scrollElement.value.scrollLeft = el.offsetLeft - scrollElement.value.clientWidth + el.clientWidth;
|
||||
};
|
||||
|
||||
defineExpose({ applyUpdate, refreshScroller, resetSort, resizeResults, downloadTable });
|
||||
defineExpose({
|
||||
applyUpdate,
|
||||
refreshScroller,
|
||||
resetSort,
|
||||
resizeResults,
|
||||
downloadTable
|
||||
});
|
||||
|
||||
watch(() => props.results, () => {
|
||||
setLocalResults();
|
||||
|
Reference in New Issue
Block a user