Skip to content

refactor(toolbar): improve slot layout and visibility handling #30371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: next
Choose a base branch
from

Conversation

ShaneK
Copy link
Member

@ShaneK ShaneK commented Apr 24, 2025

Issue number: resolves internal


What is the current behavior?

Currently, the Ionic theme toolbar uses position: absolute in modals to center its text or just text-align: center in other scenarios. This can lead to issues with alignment that can cause overlapping elements.

image

What is the new behavior?

This new behavior reworks how slots get rendered and the content gets placed in the toolbar. It no longer relies on host-context at all (which doesn't work in Firefox) and instead uses flex to lay out the toolbar and responsively react to the content around it.

This does, however, have the drawback of preventing us from properly centering the content of the toolbar with just CSS, so there's new JavaScript that checks for content in certain slots and shows/hides slots based on whether or not there's anything in them, to allow the toolbar content to properly center itself.

toolbar-new.mp4

All of this combined leads to a much nicer toolbar experience that's actually responsive and works for any type of content - not just ion-titles.

Screenshots

Many of the screenshots had to be updated because the previous version of the toolbar was absolutely positioned in most cases and had a 3px top and bottom padding. This change removes that padding and makes it more closely align with the Figma mocks.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Preview:

Toolbar

@ShaneK ShaneK requested a review from a team as a code owner April 24, 2025 17:51
@ShaneK ShaneK requested a review from brandyscarney April 24, 2025 17:51
Copy link

vercel bot commented Apr 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 29, 2025 9:31pm
Co-authored-by: Brandy Smith <brandyscarney@users.noreply.github.com>
Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

A few minor changes requested. Looks really good!

Co-authored-by: Brandy Smith <brandyscarney@users.noreply.github.com>
Copy link
Member

Choose a reason for hiding this comment

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

Good fix!

title-center

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core @ionic/core package
3 participants