fix(app): align composer fullscreen controls with the text rail (#9821)

Fullscreen controls retained a fixed toolbar overhang and aligned to the Send arrow inside its disc. Align their visible glyph edges with the text column independently of the toolbar geometry.
This commit is contained in:
Mohamed Boudra authored and GitHub committed 2026-11-16 10:07:15 +07:00
1 parent 39db933e6b
commit 4f97abc62a
4 files changed
+18 -25

No files matched your search

@@ -2346,7 +2346,6 @@ export const MessageInput = forwardRef<MessageInputRef, MessageInputProps>(
<ComposerInputPresentation
fullscreen={isFullscreen}
controlSizing={controlSizing}
sendIconSize={toolbarGlyph.size}
surface={textSurface}
toolbar={toolbar}
send={sendButton}
@@ -23,14 +23,13 @@ function keepEditorFocused(event: import("react-native").PointerEvent) {
/**
* One tree for both layout modes. The editing surface keeps its position so the
* mounted editor, its native buffer, selection, and focus survive every toggle;
* only the chrome around it changes. Fullscreen shows exit top right and Send
* bottom right, both on the rail the inline Send button uses; a send error sits
* only the chrome around it changes. Fullscreen keeps the exit glyph on the text
* rail and Send at the bottom right; a send error sits
* in the same footer as Send.
*/
export function ComposerInputPresentation({
fullscreen,
controlSizing,
sendIconSize,
surface,
toolbar,
send,
@@ -47,7 +46,6 @@ export function ComposerInputPresentation({
fullscreen: boolean;
/** The sizing the toolbar's stylesheet resolves to; see `resolveControlSizing`. */
controlSizing: ControlSizing;
sendIconSize: number;
surface: ReactNode;
toolbar: ReactNode;
send: ReactNode;
@@ -69,7 +67,6 @@ export function ComposerInputPresentation({
const glyphSize = iconSizeFor("md")[controlSizing];
const railOffset = resolveGlyphRailOffset({
controlSize: TOOLBAR_CONTROL_SIZES[controlSizing],
sendIconSize,
glyphIconSize: glyphSize,
});
const maximizeIcon = useCallback(
@@ -80,8 +77,8 @@ export function ComposerInputPresentation({
(color: string) => <Minimize2 color={color} size={glyphSize} />,
[glyphSize],
);
// The toolbar row bleeds 6px past the input padding; the inline glyph sits on that edge.
const enterStyle = useMemo(() => [styles.enterButton, { right: -6 + railOffset }], [railOffset]);
// Fullscreen controls share the text rail; the toolbar disc owns its separate corner inset.
const enterStyle = useMemo(() => [styles.enterButton, { right: railOffset }], [railOffset]);
const exitStyle = useMemo(() => [styles.iconButton, { marginRight: railOffset }], [railOffset]);
return (
<View
@@ -603,12 +603,14 @@ describe("retained selection", () => {
});
describe("fullscreen glyph rail", () => {
it("nudges 16px fullscreen glyphs onto the Send arrow's ink edge", () => {
expect(
resolveGlyphRailOffset({ controlSize: 28, sendIconSize: 16, glyphIconSize: 16 }),
).toBeCloseTo(4 / 3);
expect(
resolveGlyphRailOffset({ controlSize: 28, sendIconSize: 20, glyphIconSize: 16 }),
).toBeCloseTo(1 / 6);
it.each([
{ controlSize: 28, glyphIconSize: 16 },
{ controlSize: 44, glyphIconSize: 20 },
])("puts the visible fullscreen edge on the text rail ($controlSize)", (geometry) => {
const offset = resolveGlyphRailOffset(geometry);
// Maximize2 and Minimize2 reach x21 in a 24-unit viewBox, with a 2-unit stroke.
const inkInset =
(geometry.controlSize - geometry.glyphIconSize) / 2 + (geometry.glyphIconSize * 2) / 24;
expect(offset + inkInset).toBeCloseTo(0);
});
});
+5 -10
View File
@@ -234,21 +234,16 @@ export async function stopRealtimeVoice(ctx: StopRealtimeVoiceContext): Promise<
}
/**
* Offset that aligns a glyph's visible ink with the Send arrow's ink when both sit in
* equal controls on the same right rail. In Lucide's 24px viewBox ArrowUp ends at
* x19 while Maximize2/Minimize2 end at x21, so equal boxes leave the fullscreen
* glyphs visibly past the arrow.
* Put the fullscreen glyph's visible right edge on the text rail, letting its
* hit area extend into the padding. Both Lucide glyphs reach x21 of 24 and use
* the default 2-unit stroke (one viewBox unit beyond the path).
*/
export function resolveGlyphRailOffset(input: {
controlSize: number;
sendIconSize: number;
glyphIconSize: number;
}): number {
const arrowInkInset =
(input.controlSize - input.sendIconSize) / 2 + (5 * input.sendIconSize) / 24;
const glyphInkInset =
(input.controlSize - input.glyphIconSize) / 2 + (3 * input.glyphIconSize) / 24;
return arrowInkInset - glyphInkInset;
const inkInset = (input.controlSize - input.glyphIconSize) / 2 + (2 * input.glyphIconSize) / 24;
return -inkInset;
}
export function resolveComposerSurfaceText(