Skip to content

Scale back to the add button's margin centering - #259

Merged
alex-rawlings-yyc merged 2 commits into
mainfrom
202-center-add-button-by-margin
Aug 20, 2026
Merged

Scale back to the add button's margin centering#259
alex-rawlings-yyc merged 2 commits into
mainfrom
202-center-add-button-by-margin

Conversation

@imnasnainaec

@imnasnainaec imnasnainaec commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Scales #214 back to the one change in it that stands on its own, now that the upstream fix it was working around has landed and been built.

paranext/paranext-core#2667 moved the platform Button's press nudge off the shared --tw-translate-y custom property onto transform. Verified it is consumable, not just merged:

  • ff22ea69aa9 is an ancestor of paranext-core main
  • the committed lib/platform-bible-react/dist was rebuilt after it (238ace491d3, 779ab347d27, 35a09c06276), and the live class in both the ESM and CJS bundles is now tw:active:not-aria-[haspopup]:transform-[translateY(1px)]
  • this repo resolves platform-bible-react as a lockfile link to ../paranext-core/lib/platform-bible-react, so there is no version to bump — pulling paranext-core main is enough

The browser applies translate before transform, so a caller's -translate-x-1/2 -translate-y-1/2 composes with the nudge instead of replacing it. Translate-centering a platform Button is correct again.

What's kept

Centering the suggestion "+" by margin inside an inset-y-0 box, in TokenChip.tsx, plus a test for it. This one earns its place independent of the bug it was written for:

  • it keeps centering out of the transform channel entirely, so it can't be re-broken by a future Button variant, animation utility, or anything else that writes translate — #2667 only moved the current nudge, and the Button still carries tw:transition-all
  • it drops a percentage translate resolved against a containing block whose height needn't be an even number of pixels, on a 10px icon sitting against the input border

What's dropped

  • The arc split button (ArcOverlay.tsx) and its test, back to what main had. Keep icon buttons centered while pressed #214 centered it with an inline style transform, which #2667's own note lists among the things that still override the nudge — so that button would have silently lost its press feedback.
  • Both not.toMatch(/translate/) assertions. Their premise — that a translate utility on a platform Button is unsafe — is no longer true, and the assertion would forbid an approach that is now fine. The invariant lives upstream in button.test.tsx, where it covers every caller rather than these two.

Test plan

  • npx jest — 63 suites, 1785 tests pass
  • npm run lint — eslint, stylelint, tsc --noEmit, dependency scope all clean
  • Not verified by hand in the running app; the centering swap is like-for-like (the containing block is the tw:relative span, and the button has a definite h-2.5), but a visual check of the "+" against the gloss input border is worth doing before this comes out of draft.

Follow-ups

Branched from 202-suggestion-add-button-jumps (rebased onto main) so @alex-rawlings-yyc's commit keeps its attribution; the scale-back is the commit on top.

🤖 Generated with Claude Code


This change is Reviewable

Summary by CodeRabbit

  • Style

    • Improved the vertical alignment of the suggestion “+” button within gloss fields.
    • Preserved the button’s existing appearance and visibility behavior.
  • Tests

    • Added coverage to verify the button remains vertically centered.

alex-rawlings-yyc and others added 2 commits August 20, 2026 16:02
The platform button's pressed style is a translate, which overwrites the
same custom property a translate utility uses for centering — so the
suggestion "+" and the arc split button both jumped mid-click.
The platform Button no longer clobbers a caller's centering translate:
paranext/paranext-core#2667 moved its press nudge off the shared
`--tw-translate-y` custom property onto `transform`, and the rebuilt
`platform-bible-react` carrying that fix is on `paranext-core` main.

Translate-centering a platform Button is therefore correct again, so the
arc split button and its test go back to what `main` had. Kept only the
part that stands on its own: centering the suggestion "+" by margin
inside an `inset-y-0` box, which keeps centering out of the transform
channel the Button transitions and writes to on press.

Also dropped the `not.toMatch(/translate/)` assertions. Their premise —
that a translate utility on a platform Button is unsafe — is no longer
true, and the invariant now lives upstream in `button.test.tsx`, where it
covers every caller rather than these two.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 01ebd514-9b45-4a6e-97b8-303c7c32afdd

📥 Commits

Reviewing files that changed from the base of the PR and between b9e9d80 and 678972f.

📒 Files selected for processing (2)
  • src/__tests__/components/TokenChip.suggestions.test.tsx
  • src/components/TokenChip.tsx

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The TokenChip suggestion-add button now centers vertically with automatic margins. A test verifies the new styling.

Changes

TokenChip suggestion centering

Layer / File(s) Summary
Suggestion button centering
src/components/TokenChip.tsx, src/__tests__/components/TokenChip.suggestions.test.tsx
The button uses full vertical insets and automatic margins instead of translated top positioning. The test verifies the centering styles.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 67897

This is a localized change to center the suggestion button by margin and update its test coverage; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: alex-rawlings-yyc

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes scaling back changes while retaining margin-based centering for the add button, which matches the main pull request objective.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 202-center-add-button-by-margin

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@imnasnainaec imnasnainaec self-assigned this Aug 20, 2026
@imnasnainaec
imnasnainaec marked this pull request as ready for review August 20, 2026 20:13
@imnasnainaec
imnasnainaec marked this pull request as draft August 20, 2026 20:21
@imnasnainaec
imnasnainaec marked this pull request as ready for review August 20, 2026 20:38

@alex-rawlings-yyc alex-rawlings-yyc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alex-rawlings-yyc reviewed 2 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on imnasnainaec).

@alex-rawlings-yyc
alex-rawlings-yyc merged commit b50633f into main Aug 20, 2026
10 checks passed
@alex-rawlings-yyc
alex-rawlings-yyc deleted the 202-center-add-button-by-margin branch August 20, 2026 22:08
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.

2 participants