Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(forms): keep poll 100% on one line (#8196)

Wolf Mermelsteinb25a95b4078b
diff --git a/apps/web/src/features/block-form/components/poll/poll-bars.test.tsx b/apps/web/src/features/block-form/components/poll/poll-bars.test.tsx
index 60afc2fb4a..059878e11b 100644
--- a/apps/web/src/features/block-form/components/poll/poll-bars.test.tsx
+++ b/apps/web/src/features/block-form/components/poll/poll-bars.test.tsx
@@ -47,6 +47,26 @@ it('is one tab stop: arrows move between options, Space votes, and the note says
expect(screen.queryByText('Results are hidden.')).toBeNull();
});
+it('keeps 0% and 100% on one line each so the percent column does not wrap', () => {
+ render(() => (
+ <PollBars
+ question="Tried it?"
+ bars={[
+ { optionId: 'no', label: 'No', count: 0, percent: 0, mine: false },
+ { optionId: 'yes', label: 'Yes', count: 4, percent: 100, mine: false },
+ ]}
+ showResults
+ hiddenNote=""
+ multi={false}
+ disabled={false}
+ summary="4 votes · one vote each"
+ onVote={() => {}}
+ />
+ ));
+ expect(screen.getByText('0%').textContent).toBe('0%');
+ expect(screen.getByText('100%').textContent).toBe('100%');
+});
+
it('keeps the focused option mounted when live counts and the saved vote refresh', async () => {
const [pending, setPending] = createSignal(false);
const [options, setOptions] = createSignal([
diff --git a/apps/web/src/features/block-form/components/poll/poll-bars.tsx b/apps/web/src/features/block-form/components/poll/poll-bars.tsx
index f4b4c7132d..5ca0238830 100644
--- a/apps/web/src/features/block-form/components/poll/poll-bars.tsx
+++ b/apps/web/src/features/block-form/components/poll/poll-bars.tsx
@@ -124,7 +124,12 @@ export function PollBars(props: {
<span class="sr-only">
{bar().count === 1 ? ' vote' : ' votes'}
</span>
- <span aria-hidden="true" class="w-8 text-right font-medium">
+ {/* w-8 (32px) is narrower than tabular "100%" (~35px),
+ and some engines break before "%". */}
+ <span
+ aria-hidden="true"
+ class="w-10 shrink-0 text-right font-medium whitespace-nowrap"
+ >
{bar().percent}%
</span>
</span>