Ajustes de usabilidade no Manage time
This commit is contained in:
@@ -1053,18 +1053,14 @@
|
||||
restoreModalScrollState(overlay, previousScrollState);
|
||||
|
||||
window.requestAnimationFrame(() => {
|
||||
if (
|
||||
!appState.detailModal &&
|
||||
!appState.actionFormModal &&
|
||||
!appState.rampComparisonModal &&
|
||||
!appState.forecastUpdateConfirmModal &&
|
||||
!appState.timeManagementModal &&
|
||||
requestedFocusSelector
|
||||
) {
|
||||
if (requestedFocusSelector && shouldRestoreFocusAfterRender()) {
|
||||
const focusTarget = overlay.querySelector(requestedFocusSelector);
|
||||
|
||||
if (focusTarget instanceof HTMLElement) {
|
||||
focusTarget.focus({ preventScroll: true });
|
||||
if (focusTarget instanceof HTMLInputElement) {
|
||||
focusTarget.select();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1073,6 +1069,20 @@
|
||||
});
|
||||
}
|
||||
|
||||
function shouldRestoreFocusAfterRender() {
|
||||
if (appState.pendingFocusSelector) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
!appState.detailModal &&
|
||||
!appState.actionFormModal &&
|
||||
!appState.rampComparisonModal &&
|
||||
!appState.forecastUpdateConfirmModal &&
|
||||
!appState.timeManagementModal
|
||||
);
|
||||
}
|
||||
|
||||
function scrollPendingTimeManagementHighlightIntoView(overlay) {
|
||||
const rowId = cleanString(appState.pendingTimeManagementHighlightRowId);
|
||||
|
||||
@@ -5934,9 +5944,10 @@
|
||||
}
|
||||
|
||||
const srNumber = type === "non-service" ? "non-service-sr" : "";
|
||||
const nextRow = createBlankTimeManagementEntryRow(srNumber, "manual");
|
||||
const nextRows = [
|
||||
...getTimeManagementRows(appState.timeManagementModal),
|
||||
createBlankTimeManagementEntryRow(srNumber, "manual"),
|
||||
nextRow,
|
||||
];
|
||||
|
||||
appState.timeManagementModal = {
|
||||
@@ -5945,6 +5956,10 @@
|
||||
highlightRowId: "",
|
||||
saveErrorMessage: "",
|
||||
};
|
||||
appState.pendingFocusSelector = getTimeManagementComboboxFocusSelector(
|
||||
nextRow.id,
|
||||
type === "non-service" ? "taskType" : "sr"
|
||||
);
|
||||
renderModal();
|
||||
}
|
||||
|
||||
@@ -5980,9 +5995,34 @@
|
||||
deletedTimeEntryIds,
|
||||
saveErrorMessage: "",
|
||||
};
|
||||
appState.pendingFocusSelector = getTimeManagementPostDeleteFocusSelector(
|
||||
nextRows,
|
||||
rows,
|
||||
normalizedRowId
|
||||
);
|
||||
renderModal();
|
||||
}
|
||||
|
||||
function getTimeManagementComboboxFocusSelector(rowId, field) {
|
||||
return `.arch-panel-extension-combobox input[data-row-id="${cssEscape(rowId)}"][data-combobox-field="${cssEscape(field)}"]`;
|
||||
}
|
||||
|
||||
function getTimeManagementPostDeleteFocusSelector(nextRows, previousRows, removedRowId) {
|
||||
if (!nextRows.length) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const removedIndex = previousRows.findIndex(
|
||||
(row) => cleanString(row?.id) === cleanString(removedRowId)
|
||||
);
|
||||
const focusIndex = Math.min(Math.max(removedIndex, 0), nextRows.length - 1);
|
||||
const focusRow = nextRows[focusIndex];
|
||||
|
||||
return focusRow?.id
|
||||
? `.arch-panel-extension-time-management-delete[data-row-id="${cssEscape(focusRow.id)}"]`
|
||||
: "";
|
||||
}
|
||||
|
||||
function getTimeManagementRowById(modal, rowId) {
|
||||
const rows = getTimeManagementRows(modal);
|
||||
const normalizedRowId = cleanString(rowId);
|
||||
@@ -10308,7 +10348,7 @@
|
||||
scrollbar-gutter: stable;
|
||||
}
|
||||
|
||||
.arch-panel-extension-time-management-rows:focus-within {
|
||||
.arch-panel-extension-time-management-rows:has(.arch-panel-extension-combobox:focus-within) {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user