mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-18 00:29:42 +03:00
fix(web-test): focus-click для reveal/scroll не должен входить в edit-mode
После focus-click перед PageDown (reveal-loop) или ArrowRight/Left (horizontal scroll) клавиатурная навигация ломалась если click попадал в Number/Date ячейку — она автоматически входила в edit-mode, и стрелки начинали навигацию внутри input вместо движения по гриду. Два изменения: 1. findFocusCellScript generic mode (без direction) теперь берёт cells[0] вместо cells.slice(1) — то есть первую видимую колонку. В document tabular sections это типично Reference (Номенклатура), которая не входит в edit-mode по single click. Защиту от tree-toggles оставил точечно: для tree-гридов (presence of .gridBoxTree) пропускаем первую колонку как и раньше. 2. В click-cell.mjs после focus-click в revealAndFindCell и scrollGridToCell добавил тот же isInputFocusedInGrid + Escape страховочный фолбек, что и в deleteTableRow — на случай если focus всё же попал в input. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// web-test table/click-cell v1.1 — click a cell in a form grid by (row, column).
|
||||
// web-test table/click-cell v1.2 — click a cell in a form grid by (row, column).
|
||||
// Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
//
|
||||
// Routed from core/click.mjs when the user calls clickElement({row, column}) and
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
import { page } from '../core/state.mjs';
|
||||
import { waitForStable } from '../core/wait.mjs';
|
||||
import { modifierClick, returnFormState } from '../core/helpers.mjs';
|
||||
import { modifierClick, returnFormState, isInputFocusedInGrid } from '../core/helpers.mjs';
|
||||
import { scrollHorizontallyByKey } from '../core/scroll-horiz.mjs';
|
||||
import {
|
||||
findGridCellScript, findFocusCellScript, snapshotGridScript,
|
||||
@@ -115,6 +115,12 @@ async function revealAndFindCell({ formNum, gridSelector, target, scroll }) {
|
||||
if (!focusPt) return { error: 'no_focusable_cell' };
|
||||
await page.mouse.click(focusPt.x, focusPt.y);
|
||||
await page.waitForTimeout(FOCUS_WAIT_MS);
|
||||
// Click on a Number/Date cell auto-enters edit mode in 1С; PageDown there
|
||||
// is a no-op. Exit edit mode before driving the reveal loop.
|
||||
if (await isInputFocusedInGrid({ gridSelector })) {
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitForTimeout(150);
|
||||
}
|
||||
|
||||
let prevSnap = await page.evaluate(snapshotGridScript(gridSelector));
|
||||
for (let i = 0; i < limit; i++) {
|
||||
@@ -155,6 +161,12 @@ async function scrollGridToCell({ formNum, gridSelector, target, cell }) {
|
||||
if (!focusPt) throw new Error('clickElement: no visible cell to focus for horizontal scroll');
|
||||
await page.mouse.click(focusPt.x, focusPt.y);
|
||||
await page.waitForTimeout(FOCUS_WAIT_MS);
|
||||
// Click on a Number/Date cell auto-enters edit mode in 1С; arrow keys there
|
||||
// navigate text inside the input rather than scrolling the viewport. Exit first.
|
||||
if (await isInputFocusedInGrid({ gridSelector })) {
|
||||
await page.keyboard.press('Escape');
|
||||
await page.waitForTimeout(150);
|
||||
}
|
||||
|
||||
await scrollHorizontallyByKey({
|
||||
page,
|
||||
|
||||
Reference in New Issue
Block a user