Repository navigation
Put the form link under its label instead of across the column - #21
Merged
Merged
Conversation
The "Set range" link is floated right inside the label. Active Admin gives a form label a 240px column, so the link lands at the far right of that column with nothing between it and the fields it operates on -- 179px from the label it belongs to. The README screenshots show it on its own line directly under the label text, which is what the narrower label column of the Active Admin of the time produced from the same float. Three examples pin the form placement -- left edge aligned with the label, own line, shrink-to-fit width -- and a fourth pins the sidebar filter, where the same CSS rule applies and right alignment is correct and must not move. The two form-placement examples fail here; the width guard and the sidebar guard pass, which is the point of having them. This commit is expected to fail CI.
Scope a rule to .datetime_preset_pair that drops the float and puts the link on its own line under the label text, shrink-to-fit so the dashed underline stays under the words. The float itself is unchanged since 2017 and was right for the label widths of the Active Admin of the time: too narrow for the text and the link to share a line, so the float wrapped underneath, which is what the README screenshots show. Active Admin 3 gives the label a 240px column, both fit, and the link ends up at the far right of it. The sidebar filter keeps the float -- its label and link share a narrow panel, and right alignment there is both correct and what the first README screenshot shows. The spec pins that too, so this cannot drift.
Fivell
force-pushed
the
fix/form-link-placement
branch
from
October 1, 2026 12:49
533e424 to
884dd56
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spotted by comparing fresh screenshots of current master against the ones in the README.
What it looks like
The README shows the form's "Set range" on its own line, directly under the label text. On Active Admin 3 it renders at the far right of the label column instead — 179px from the label it belongs to, with nothing between it and the inputs it drives.
Measured on a live page before the fix:
Why
Not a regression in this gem. The rule is unchanged since 2017:
git logon the stylesheet ends at66973db(2017-08-16), and the line that inserts the link into the label last changed in5a3742c(2022-05-24). Nothing in the recent run of fixes touched either.What changed is the label width Active Admin hands it. A float is taken out of flow and placed at the right of the current line; if it does not fit, it drops to the next one. The older Active Admin's label column was narrow enough that the text and the link could not share a line, so the float wrapped underneath — the look the README captured. Active Admin 3's 240px column fits both, so it stays up and to the right.
The fix
display: tablekeeps it shrink-to-fit, so the dashed underline stays under the words rather than stretching the whole 240px column.The sidebar filter deliberately keeps the float. There the label and link share a narrow panel, right alignment is correct, and it is what the first README screenshot shows. That is the other half of the same rule, so the spec pins it as well — a fix for one context must not move the other.
Specs
Four examples reading
getBoundingClientRect()from the rendered page:Two fail on the parent commit, two pass by design. 28 examples, 0 failures after.