Skip to content

fix: open a title-bar dropdown under its own button - #74

Merged
Fivell merged 1 commit into
masterfrom
fix/title-bar-dropdown-alignment
Oct 20, 2026
Merged

Fivell merged 1 commit into
masterfrom
fix/title-bar-dropdown-alignment

Conversation

@Fivell

@Fivell Fivell commented Oct 20, 2026

Copy link
Copy Markdown
Member

Problem

The right-alignment guard for title-bar dropdowns pins the panel with
right: 0 !important. But div.dropdown_menu is unpositioned — ActiveAdmin
leaves it display: inline — and the theme resets #titlebar_right to
position: static, so the panel's containing block ends up being #title_bar
(sticky). Every menu therefore opened at the bar's far right, under whichever
action item sits last, instead of under the button that was clicked.

A bar whose only dropdown is the rightmost item looks fine, which is why this
slipped through; it shows up as soon as a dropdown has another action item
after it.

Fix

Give div.dropdown_menu position: relative so right: 0 means the trigger's
right edge, plus display: inline-block — an inline box's containing block
spans its text fragments, and the whitespace around the button in AA's markup
pushed the panel a few pixels past the button.

The nipple needs the same treatment: AA offsets the arrow from the panel's
left edge by the button's centre, which lands it on empty bar once the panel
is right-aligned. It is now pinned right, centred on the button's own caret.

Test case

test/dummy's wide table now renders four action items — two of them
dropdowns, one of those in the middle — the shape that reproduces it.
Measured on that page (bar 1200px wide, panel right edge vs. button right edge):

Actions (middle) More (last)
before panel 1200 / button 1000 panel 1200 / button 1170
after panel 1000 / button 1000 panel 1170 / button 1170

rake css passes.

The right-alignment guard added for title-bar dropdowns pinned the panel
with `right: 0`, but `div.dropdown_menu` is unpositioned (AA leaves it
`display: inline`) and the theme resets `#titlebar_right` to static — so
the panel resolved against `#title_bar` instead and every menu opened at
the bar's far right, under whichever action item happens to sit last.
Only bars with a dropdown that is not the rightmost item showed it.

Make the dropdown its own containing block, so `right: 0` means the
trigger's right edge. inline-block over AA's `display: inline`: an inline
box's containing block spans its text fragments, and the whitespace
around the button in the markup pushed the panel a few pixels past it.
The nipple is pinned right for the same reason - AA offsets the arrow
from the panel's left edge by the button's centre, which lands it on
empty bar once the panel is right-aligned.

The dummy app's wide table now carries four action items, two of them
dropdowns, one of those in the middle - the shape that reproduces it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused positioning changes address the reported issue with no identified blockers.

No open issues 🎉

What changed in this PR

Fixes title-bar dropdowns opening beneath the wrong action item in the ActiveAdmin theme.

Changes:

  • Anchors each dropdown panel to its own button.
  • Aligns the panel arrow with the button’s caret.
  • Adds a multi-action dummy page example with middle and rightmost dropdowns.
File Description
test/​dummy/​app/​admin/​wide_table.rb Adds action items that reproduce the alignment issue.
app/​assets/​stylesheets/​wigu/​active_admin_theme.scss Positions dropdown panels and arrows beneath their triggers.

Review effort: Balanced

@Fivell
Fivell force-pushed the fix/title-bar-dropdown-alignment branch from 745b838 to 9d2fbeb Compare October 20, 2026 16:12
@Fivell

Fivell commented Oct 20, 2026

Copy link
Copy Markdown
Member Author

Before / after on the dummy app's wide table — bar 1200px wide, the Actions dropdown sits in the middle, More is last.

Before — clicking Actions opens its panel at the bar's right edge, under More:

before-actions

After — Actions opens under its own button:

after-actions

After — More, the last item, still right-aligned to its own button:

after-more

Panel right edge vs. button right edge on that page: before 1200/1000 and 1200/1170, after 1000/1000 and 1170/1170.

@Fivell
Fivell merged commit bcf69d6 into master Oct 20, 2026
7 checks passed
@Fivell
Fivell deleted the fix/title-bar-dropdown-alignment branch October 20, 2026 16:20
@Fivell Fivell mentioned this pull request Oct 20, 2026
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