Keep keyboard offsets tied to visibility
Derive app keyboard offsets from one provider-owned shared value so chat content, composer surfaces, and floating panels share the same policy. Treat progress-zero keyboard samples as closed, even if Android reports a stale nonzero height.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveKeyboardShift } from "./keyboard-shift-policy";
|
||||
|
||||
describe("resolveKeyboardShift", () => {
|
||||
it("keeps the existing open-keyboard offset behavior", () => {
|
||||
expect(
|
||||
resolveKeyboardShift({
|
||||
rawKeyboardHeight: 320,
|
||||
keyboardProgress: 1,
|
||||
bottomInset: 24,
|
||||
isIos: false,
|
||||
iosMinHeight: 120,
|
||||
}),
|
||||
).toBe(296);
|
||||
});
|
||||
|
||||
it("treats progress zero as closed even when Android reports a stale height", () => {
|
||||
expect(
|
||||
resolveKeyboardShift({
|
||||
rawKeyboardHeight: 320,
|
||||
keyboardProgress: 0,
|
||||
bottomInset: 24,
|
||||
isIos: false,
|
||||
iosMinHeight: 120,
|
||||
}),
|
||||
).toBe(0);
|
||||
});
|
||||
|
||||
it("still ignores small iOS accessory bar reports", () => {
|
||||
expect(
|
||||
resolveKeyboardShift({
|
||||
rawKeyboardHeight: 80,
|
||||
keyboardProgress: 1,
|
||||
bottomInset: 0,
|
||||
isIos: true,
|
||||
iosMinHeight: 120,
|
||||
}),
|
||||
).toBe(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user