Skip to content

[6.x] Use resize observer for the floating toolbar#14171

Closed
jaygeorge wants to merge 2 commits into6.xfrom
use-resize-observer-for-the-floating-toolbar
Closed

[6.x] Use resize observer for the floating toolbar#14171
jaygeorge wants to merge 2 commits into6.xfrom
use-resize-observer-for-the-floating-toolbar

Conversation

@jaygeorge
Copy link
Contributor

Description of the Problem

We currently use a media query to switch to the "floating toolbar" layout for smaller viewports, where actions start to wrap.

While we could sort of get away with this before, the goal posts have changed now that we have keyboard shortcuts attached to items, resulting in the old layout persisting, even when items have wrapped.

Before fix
2026-03-09 at 11 18 01@2x

What this PR Does

  • Unfortunately, it's not possible to detect height or flex row changes with CSS alone, so I've added JavaScript resize observer to effectively toggle the "wrapped" layout instead. This is a very similar implementation to the button group resize observer implementation.
  • Also fix the row box-shadow when the layout is wrapped
  • Closes Action Bar Buttons on separate lines #14170

After fix
2026-03-09 at 11 13 40@2x

How to Reproduce

  1. Go to cp/assets and select something
  2. Pull the window in so the floating actions wrap

…than media queries. This is a similar implementation to the button group fieldtype
@daun
Copy link
Contributor

daun commented Mar 9, 2026

Nice! There is a related PR at #13336 which solves this in a similar way for the action toolbar and the button group fieldtype. Is there any chance we could merge the two or extend this one to also cover button group fieldtypes?

@jaygeorge
Copy link
Contributor Author

Oh! I actually thought that was already merged – hence me referring to it :)
I'll ask Jason to take a look now that he's out of the Security Phantom Zone

@jasonvarga
Copy link
Member

I'd say lets stick to the other one. It solves the floating toolbar AND button group field usage on its own.

@daun
Copy link
Contributor

daun commented Mar 9, 2026

Alright, let me try and resolve the merge conflicts on that one then.

@daun
Copy link
Contributor

daun commented Mar 9, 2026

Updated the other pr and added a comment on whether to define a default value for overflow behavior.

@jaygeorge jaygeorge closed this Mar 9, 2026
@jaygeorge
Copy link
Contributor Author

Closing this in favour of #13336

@jaygeorge jaygeorge deleted the use-resize-observer-for-the-floating-toolbar branch March 10, 2026 10:27
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.

Action Bar Buttons on separate lines

3 participants