Center the login card vertically on Keycloak 11 - #483
Merged
Merged
Conversation
PatternFly 3 anchors the login page to the top of the viewport with fixed padding, so the card sat in the upper third of the screen. Make the page a min-height:100vh flex column and centre the card with auto margins, which degrade to normal scrolling on viewports shorter than the card instead of clipping its top edge. Keycloak 26 already centres via PatternFly 5's login grid, so kc26.css is untouched. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
On Keycloak 11 (what prod runs), the login card sat pinned to the top of the viewport with a large empty area below it; it is now vertically centered, matching what Keycloak 26 already does via PatternFly 5's login grid. PatternFly 3 top-anchors
.login-pf-pagewith fixed padding, so the page becomes amin-height: 100vhflex column and the card centers with auto margins rather thanjustify-content: center— auto margins collapse on viewports shorter than the card, so the page scrolls normally instead of clipping the card's top edge. The card also getswidth: 100%(capped by the existing 400px max-width) so sparse pages like the error page keep full card width now that flex sizing applies, and the phone breakpoint keeps its 16px gutters while preserving the vertical centering.Validated with the theme dev harness (
keycloak/compose.theme-dev.yml) andkeycloak/tests/screenshot.shon both KC 11 and KC 26: desktop login, mobile login, invalid-credentials, and both error pages all render centered with no clipping, andcheck-css.shandsmoke.shpass on both versions.🤖 Generated with Claude Code