Ajustes de usabilidade no Manage time

This commit is contained in:
Paulo Porto
2026-05-08 17:41:46 -03:00
parent f574ba936c
commit f196067b21
2 changed files with 52 additions and 11 deletions

View File

@@ -1053,18 +1053,14 @@
restoreModalScrollState(overlay, previousScrollState); restoreModalScrollState(overlay, previousScrollState);
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
if ( if (requestedFocusSelector && shouldRestoreFocusAfterRender()) {
!appState.detailModal &&
!appState.actionFormModal &&
!appState.rampComparisonModal &&
!appState.forecastUpdateConfirmModal &&
!appState.timeManagementModal &&
requestedFocusSelector
) {
const focusTarget = overlay.querySelector(requestedFocusSelector); const focusTarget = overlay.querySelector(requestedFocusSelector);
if (focusTarget instanceof HTMLElement) { if (focusTarget instanceof HTMLElement) {
focusTarget.focus({ preventScroll: true }); 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) { function scrollPendingTimeManagementHighlightIntoView(overlay) {
const rowId = cleanString(appState.pendingTimeManagementHighlightRowId); const rowId = cleanString(appState.pendingTimeManagementHighlightRowId);
@@ -5934,9 +5944,10 @@
} }
const srNumber = type === "non-service" ? "non-service-sr" : ""; const srNumber = type === "non-service" ? "non-service-sr" : "";
const nextRow = createBlankTimeManagementEntryRow(srNumber, "manual");
const nextRows = [ const nextRows = [
...getTimeManagementRows(appState.timeManagementModal), ...getTimeManagementRows(appState.timeManagementModal),
createBlankTimeManagementEntryRow(srNumber, "manual"), nextRow,
]; ];
appState.timeManagementModal = { appState.timeManagementModal = {
@@ -5945,6 +5956,10 @@
highlightRowId: "", highlightRowId: "",
saveErrorMessage: "", saveErrorMessage: "",
}; };
appState.pendingFocusSelector = getTimeManagementComboboxFocusSelector(
nextRow.id,
type === "non-service" ? "taskType" : "sr"
);
renderModal(); renderModal();
} }
@@ -5980,9 +5995,34 @@
deletedTimeEntryIds, deletedTimeEntryIds,
saveErrorMessage: "", saveErrorMessage: "",
}; };
appState.pendingFocusSelector = getTimeManagementPostDeleteFocusSelector(
nextRows,
rows,
normalizedRowId
);
renderModal(); 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) { function getTimeManagementRowById(modal, rowId) {
const rows = getTimeManagementRows(modal); const rows = getTimeManagementRows(modal);
const normalizedRowId = cleanString(rowId); const normalizedRowId = cleanString(rowId);
@@ -10308,7 +10348,7 @@
scrollbar-gutter: stable; 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; overflow: visible;
} }

View File

@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "Arch Panel Injector", "name": "Arch Panel Injector",
"version": "1.0.3", "version": "1.0.4",
"description": "Insere o botao Arch panel no header do Oracle Workload Workbench.", "description": "Insere o botao Arch panel no header do Oracle Workload Workbench.",
"permissions": [ "permissions": [
"cookies", "cookies",
@@ -175,5 +175,6 @@