Skip to content

Commit 2834b87

Browse files
kdy1claude
andcommitted
fix(desktop): open a row's menu from text in a cell that takes its own click
A cell with a `Click` of its own ended the way up from its text, so a secondary tap on the text stopped at the cell, which takes no right click, and was refused before it reached the row's `RightClick`. A cell now passes a press on unless it takes both; the press goes to the first node up that takes it, so a tap still stops at the cell's own click. Raised by michal-e2e's review of #2357. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 383587b commit 2834b87

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

‎packages/desktop/src/nodes.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,10 @@ export function projectSnapshot(
408408
};
409409
bindings.set(id, binding);
410410
// A press on a child can go to this node, and on through it to what is around it only while it has no ref of its own: a
411-
// row, a button, a list, or a scroll area ends the way up, and a cell that takes no press passes it on to its row.
412-
const passes = node.ref_id === undefined || (node.role === 'cell' && node.available_actions?.includes('Click') !== true);
411+
// row, a button, a list, or a scroll area ends the way up. A cell that does not take both a click and a right click
412+
// passes it on to its row: the press goes to the first node up that takes it, so a tap still stops at a cell's own click.
413+
const cellActions = node.available_actions ?? [];
414+
const passes = node.ref_id === undefined || (node.role === 'cell' && !(cellActions.includes('Click') && cellActions.includes('RightClick')));
413415
const aroundChildren = id === ROOT_ID ? [] : (passes ? [binding, ...around] : [binding]).slice(0, MAX_PRESS_LEVELS);
414416
const kept: RawNode[] = [];
415417
const underHidden = new Map<RawNode, 'scrolled' | 'other'>();

‎packages/desktop/tests/unit/surface.test.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,7 @@ describe('DesktopSurface: acting', () => {
14321432
available_actions: ['Scroll'],
14331433
children: [
14341434
{ role: 'row', ref_id: '@s:row', available_actions: ['RightClick'], children: [{ role: 'cell', ref_id: '@s:cell', available_actions: ['ScrollTo'], children: [{ role: 'group', children: [text('Medium')] }] }] },
1435+
{ role: 'row', ref_id: '@s:row2', available_actions: ['RightClick'], children: [{ role: 'cell', ref_id: '@s:cell2', available_actions: ['Click'], children: [text('High')] }] },
14351436
{ role: 'button', ref_id: '@s:button', name: 'Archive', available_actions: ['Click'], children: [{ role: 'image', native_id: { kind: 'ax_identifier', value: 'icon' } }] },
14361437
text('Loose'),
14371438
{
@@ -1463,7 +1464,17 @@ describe('DesktopSurface: acting', () => {
14631464
expect(last(fake, 'act')).toMatchObject({ ref: '@s:row', action: 'rightClick' });
14641465
});
14651466

1466-
it('refuses text with no row or button around it: never the list, a field, the window, or past three levels', async () => {
1467+
it("taps a cell's own click from its text, and still opens the row's menu past it", async () => {
1468+
const { surface, fake } = await launched({ snapshot: [read] }, { observe: false });
1469+
const [high] = await surface.locate(testId('High'), operation());
1470+
await surface.perform(high!.ref, { kind: 'tap' }, operation());
1471+
expect(last(fake, 'act')).toMatchObject({ ref: '@s:cell2', action: 'click' });
1472+
const [again] = await surface.locate(testId('High'), operation());
1473+
await surface.perform(again!.ref, { kind: 'secondaryTap' }, operation());
1474+
expect(last(fake, 'act')).toMatchObject({ ref: '@s:row2', action: 'rightClick' });
1475+
});
1476+
1477+
it('refuses text with no row or button around it, never the list, the window, or past three levels, and taps the field a hint is in', async () => {
14671478
const { surface, fake } = await launched({ snapshot: [read] }, { observe: false });
14681479
for (const id of ['Loose', 'Status', 'Deep']) {
14691480
const [node] = await surface.locate(testId(id), operation());

0 commit comments

Comments
 (0)