Skip to content

Commit a8e8f9a

Browse files
committed
fix(snapshot): name unavailable viewport for observed keyboard
1 parent e68b681 commit a8e8f9a

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎packages/contracts/src/tap-keyboard-occlusion.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,3 +241,15 @@ test('an unmeasurable fact leaves every golden-table decision exactly as the tre
241241
assert.deepEqual(withFact, treeOnly, fixture.name);
242242
}
243243
});
244+
245+
test('keyboard anchors without an acquisition viewport name the missing geometry and preserve tap derivation', () => {
246+
const fixture = tableCase('Gboard docked tree + visibility-only:true -> occluded');
247+
const fact = observeProviderKeyboard({ nodes: fixture.nodes, viewport: null });
248+
assert.deepEqual(fact, { kind: 'unmeasurable', reason: 'keyboard-viewport-unavailable' });
249+
assert.equal(resolveWithFact(fixture, fact).kind, 'occluded');
250+
const noKeyboard = tableCase('no keyboard in the tree means nothing to refuse');
251+
assert.deepEqual(observeProviderKeyboard({ nodes: noKeyboard.nodes, viewport: null }), {
252+
kind: 'unmeasurable',
253+
reason: 'keyboard-not-observed',
254+
});
255+
});

‎packages/contracts/src/tap-keyboard-occlusion.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,9 @@ export function observeProviderKeyboard(params: {
366366
}
367367
return {
368368
kind: 'unmeasurable',
369-
reason:
370-
params.visibility === 'failed'
369+
reason: params.nodes.some(isKeyboardAnchorNode)
370+
? 'keyboard-viewport-unavailable'
371+
: params.visibility === 'failed'
371372
? 'keyboard-visibility-probe-failed'
372373
: params.visibility === 'unsupported'
373374
? 'keyboard-visibility-probe-unsupported'

0 commit comments

Comments
 (0)