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(email): give emails bottom clearance above the mobile nav chrome (#7153)

Peter Chinmanc323ed3ba853
diff --git a/apps/web/src/features/email-compose/views/email-compose.tsx b/apps/web/src/features/email-compose/views/email-compose.tsx
index e9580faa88..24acd24c7c 100644
--- a/apps/web/src/features/email-compose/views/email-compose.tsx
+++ b/apps/web/src/features/email-compose/views/email-compose.tsx
@@ -265,8 +265,10 @@ function LoadedEmailComposeView(
</Show>
{/* No overflow clipping on desktop: the card clips its own content, and
clipping here would slice the composer shadow flat at the top and
- bottom while the side padding lets it show. */}
- <div class="macro-message-width sm:macro-message-padding mx-auto w-full min-h-120 max-h-full my-2 sm:my-12 touch:my-0 px-2 sm:px-4 touch:px-0 touch:overflow-y-auto touch:scrollbar-hidden touch:min-h-full">
+ bottom while the side padding lets it show. Full-frame mobile/tablet
+ carries the bottom inset here so the body, signature and attachment
+ pills rest above the floating chrome (ComposeLayout owns the top). */}
+ <div class="macro-message-width sm:macro-message-padding mx-auto w-full min-h-120 max-h-full my-2 sm:my-12 touch:my-0 px-2 sm:px-4 touch:px-0 touch:pb-(--mobile-content-inset-bottom) touch:overflow-y-auto touch:scrollbar-hidden touch:min-h-full">
<WrapUnlessMobile
wrapper={(children) => (
// The same card as the chat composer and the thread's message
diff --git a/apps/web/src/features/email-thread/primitives/scroll-to-message.test.ts b/apps/web/src/features/email-thread/primitives/scroll-to-message.test.ts
index f3f30d8908..d3f6c6465e 100644
--- a/apps/web/src/features/email-thread/primitives/scroll-to-message.test.ts
+++ b/apps/web/src/features/email-thread/primitives/scroll-to-message.test.ts
@@ -37,12 +37,19 @@ function box(element: HTMLElement, top: number, bottom: number): void {
function cardInList(
top: number,
bottom: number,
- list: { top?: number; bottom?: number; paddingTop?: number } = {}
+ list: {
+ top?: number;
+ bottom?: number;
+ paddingTop?: number;
+ paddingBottom?: number;
+ } = {}
) {
const container = document.createElement('div');
const element = document.createElement('div');
if (list.paddingTop)
container.style.scrollPaddingTop = `${list.paddingTop}px`;
+ if (list.paddingBottom)
+ container.style.scrollPaddingBottom = `${list.paddingBottom}px`;
box(container, list.top ?? 0, list.bottom ?? 800);
box(element, top, bottom);
return { container, element };
@@ -155,6 +162,23 @@ describe('revealDelta', () => {
const { container, element } = cardInList(200, 1200);
expect(revealDelta(container, element)).toBe(200);
});
+
+ it('keeps the revealed card clear of the mobile chrome', () => {
+ // A card that ends 40px above the scrollport edge is still under a 106px
+ // dock, so it has to scroll up to the padded edge rather than stay put.
+ const { container, element } = cardInList(200, 760, {
+ paddingBottom: 122,
+ });
+ expect(revealDelta(container, element)).toBe(82);
+ });
+
+ it('start-aligns a card that only fits the raw scrollport', () => {
+ const { container, element } = cardInList(100, 800, {
+ paddingTop: 76,
+ paddingBottom: 122,
+ });
+ expect(revealDelta(container, element)).toBe(24);
+ });
});
describe('nearestDelta', () => {
diff --git a/apps/web/src/features/email-thread/primitives/scroll-to-message.ts b/apps/web/src/features/email-thread/primitives/scroll-to-message.ts
index ca03b9638e..e7ff5b49a9 100644
--- a/apps/web/src/features/email-thread/primitives/scroll-to-message.ts
+++ b/apps/web/src/features/email-thread/primitives/scroll-to-message.ts
@@ -152,13 +152,17 @@ export function revealDelta(
): number {
const port = scrollportRect(container);
const elementBox = element.getBoundingClientRect();
- if (elementBox.height >= port.height) {
+ const topInset = scrollPaddingInset(container, 'top');
+ const bottomInset = scrollPaddingInset(container, 'bottom');
+ // "Fits" and "is off screen" are judged against the area the floating
+ // chrome leaves visible, not the raw scrollport.
+ if (elementBox.height >= port.height - topInset - bottomInset) {
return alignmentDelta(container, element, 'start');
}
- if (elementBox.top < port.top) {
+ if (elementBox.top < port.top + topInset) {
return alignmentDelta(container, element, 'start');
}
- if (elementBox.bottom > port.bottom) {
+ if (elementBox.bottom > port.bottom - bottomInset) {
return alignmentDelta(container, element, 'end');
}
return 0;
diff --git a/apps/web/src/features/email-thread/primitives/thread-reply-area.test.ts b/apps/web/src/features/email-thread/primitives/thread-reply-area.test.ts
index 75870fdd40..fedb5488fc 100644
--- a/apps/web/src/features/email-thread/primitives/thread-reply-area.test.ts
+++ b/apps/web/src/features/email-thread/primitives/thread-reply-area.test.ts
@@ -104,4 +104,11 @@ describe('thread reply placement', () => {
state.setAllMessages([]);
expect(state.area.info()).toBeUndefined();
});
+
+ it('never reports an in-flow reply input on touch', () => {
+ const state = setup(true);
+ state.setMessages([]);
+ state.setAllMessages([state.draft]);
+ expect(state.area.inFlow()).toBe(false);
+ });
});
diff --git a/apps/web/src/features/email-thread/primitives/thread-reply-area.ts b/apps/web/src/features/email-thread/primitives/thread-reply-area.ts
index f68f06c12a..f5b3612f47 100644
--- a/apps/web/src/features/email-thread/primitives/thread-reply-area.ts
+++ b/apps/web/src/features/email-thread/primitives/thread-reply-area.ts
@@ -86,8 +86,11 @@ export function createThreadReplyArea(options: {
const replyInputOpen = () =>
options.bottomReply.open() || emailReplyInfo()?.replyingTo == null;
- // Whether the compose input is rendered in normal flow.
- const replyInputInFlow = () => Boolean(replyArea() && replyInputOpen());
+ // Whether the compose input is rendered in normal flow. Touch never puts it
+ // there — phones and tablets compose in the drawer — so the message list
+ // keeps its under-scroll inset even while `bottomReply` is latched open.
+ const replyInputInFlow = () =>
+ !options.isTouch() && Boolean(replyArea() && replyInputOpen());
const mobileBottomReplyMessage = createMemo(() => {
if (options.mobileReply.open()) return;
diff --git a/apps/web/src/features/email-thread/views/email-thread.tsx b/apps/web/src/features/email-thread/views/email-thread.tsx
index f7589d02d8..e066c3448c 100644
--- a/apps/web/src/features/email-thread/views/email-thread.tsx
+++ b/apps/web/src/features/email-thread/views/email-thread.tsx
@@ -64,9 +64,9 @@ export function EmailThreadView(props: EmailThreadViewProps) {
}
>
{(draft) => (
- // The email block is bottom-anchored (no default panel inset),
- // so the compose branch pads around the chrome itself.
- <div class="size-full touch:pt-(--mobile-content-inset-top) touch:pb-(--mobile-content-inset-bottom)">
+ // The compose view carries the mobile chrome insets itself, so
+ // this branch only has to hand it the full frame.
+ <div class="size-full">
<EmailComposeView
context={viewContext.compose}
host={{
diff --git a/apps/web/src/features/email-thread/views/message-list.tsx b/apps/web/src/features/email-thread/views/message-list.tsx
index 20e9171557..3d707a36a4 100644
--- a/apps/web/src/features/email-thread/views/message-list.tsx
+++ b/apps/web/src/features/email-thread/views/message-list.tsx
@@ -96,6 +96,12 @@ export function MessageList(props: MessageListProps) {
class={cn(
'pt-1 pb-6 w-full flex flex-col items-center gap-2 overflow-y-scroll overflow-x-hidden [overflow-anchor:none] scrollbar-hidden text-sm scroll-pt-4 scroll-pb-4 scroll-smooth motion-reduce:scroll-auto',
'touch:pt-[calc(var(--mobile-content-inset-top,0)+0.5rem)] mobile:gap-0',
+ // The in-scroll insets only clear the floating chrome at the ends of
+ // the list. Every alignment in between — focusing a card, revealing one
+ // that just grew, keyboard paging — lands against the scrollport edges,
+ // so scroll-padding has to describe the same chrome or a card gets
+ // parked underneath it with its attachments out of reach.
+ 'touch:scroll-pt-[calc(var(--mobile-content-inset-top,0px)+1rem)] touch:scroll-pb-[calc(var(--mobile-content-inset-bottom,0px)+1rem)]',
props.underScrollsBottom &&
'touch:pb-[calc(var(--mobile-content-inset-bottom,0)+1.5rem)]'
)}