Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix: keep the full width beside a closed comments list - #294

Open
hardikg2907 wants to merge 1 commit into
razorpay:masterfrom
hardikg2907:hardikg2907/closed-list-room
Open

hardikg2907 wants to merge 1 commit into
razorpay:masterfrom
hardikg2907:hardikg2907/closed-list-room

Conversation

@hardikg2907

Copy link
Copy Markdown

What and why

Closes #293.

On some documents the app keeps a 392 px margin beside the document while the Comments list is closed, so an empty strip the size of the list shows at the right.

On frame ready the app asks the frame to make room for a panel that covers 0 pixels. roomFor in frontend/bridge/bridge.ts still computed a shift whenever a direct body child ended past innerWidth:

  • a sub-pixel frame width (browser zoom other than 100 %, some window widths): innerWidth is a whole number, the child's rect is not, and ceil(0.5) is 1;
  • a body child wider than the frame.

When a full-width child (for example a sticky header) leaves no left margin, the shift cannot fit, so roomFor returned null. The frame then posted crowded: true, and the app added lg:mr-[392px]. It keeps that until the list opens and closes.

The fix is one line at the top of roomFor: with no panel nothing is covered, so it returns 0, as its own comment says for a panel that covers margin only. This PR changes only this cause. The app side and the rounding in roomFor are unchanged.

Note, not changed here: onCrowded in doc-workspace.tsx accepts a crowded reply at any time. A reply sent while the list was open but delivered after it closed would still add the margin. I have not seen this happen.

How it was tested

  • New e2e in frontend/e2e/document-layout.spec.ts, next to "a document with no margin to spare makes room beside the comments list": a document with a full-width header and a block of calc(100vw + 40px), at 1440 × 900, with the list closed, keeps the full frame width.
    • Without the fix it fails: Expected: 1440, Received: 1048 (1440 − 392).
    • With the fix it passes, and the whole document-layout.spec.ts passes (13 tests, including the existing crowded-with-list-open case).
  • npm test (1308 tests), npm run lint, npm run format:check and npm run build pass.

Checklist

  • make lint and make test pass locally
  • Tests added or updated for the change
  • Docs updated (README.md, docs/, .env.example, chart values.yaml) if behaviour or configuration changed
  • No breaking change, or the migration path is described below

On frame ready the app asks the frame to make room for a panel that covers
0 pixels. roomFor still computed a shift whenever a body child ended past
innerWidth: a sub-pixel frame width (at a browser zoom other than 100 %),
or a child wider than the frame. With a full-width child there is no left
margin to move into, so roomFor returned null, the frame reported crowded,
and the app added a 392 px margin while the list was closed.

With no panel nothing is covered, so roomFor now returns 0, as its own
contract says for a panel that covers margin only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comments-list-sized empty strip beside some documents while the list is closed

1 participant