shared: a dropdown that would run past the window's right edge hangs from the right of its trigger
The state menu on an agent card that fills the width hung from the trigger's left edge, so the window cut the list off. The list now measures itself when it opens and flips to the trigger's right edge when it would overflow.
This commit is contained in:
parent
dd17b20dac
commit
608eb9dcd9
1 changed files with 46 additions and 2 deletions
12
frontend/packages/swarm-ui/test/dropdown-edge.test.mjs
Normal file
12
frontend/packages/swarm-ui/test/dropdown-edge.test.mjs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { hangsFromEnd } from "../../shared/src/dropdown/edge.ts";
|
||||
|
||||
test("a list that ends inside the window stays hung from the left", () => {
|
||||
assert.equal(hangsFromEnd(300, 1000), false);
|
||||
assert.equal(hangsFromEnd(1000, 1000), false);
|
||||
});
|
||||
|
||||
test("a list that ends past the window edge hangs from the right", () => {
|
||||
assert.equal(hangsFromEnd(1001, 1000), true);
|
||||
});
|
||||
Loading…
Reference in a new issue