Skip to content

Center the login card vertically on Keycloak 11 - #483

Merged
chrisdoehring merged 1 commit into
mainfrom
fix/keycloak-login-vertical-centering
Sep 29, 2026
Merged

chrisdoehring merged 1 commit into
mainfrom
fix/keycloak-login-vertical-centering

Conversation

@chrisdoehring

Copy link
Copy Markdown
Contributor

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-page with fixed padding, so the page becomes a min-height: 100vh flex column and the card centers with auto margins rather than justify-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 gets width: 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) and keycloak/tests/screenshot.sh on both KC 11 and KC 26: desktop login, mobile login, invalid-credentials, and both error pages all render centered with no clipping, and check-css.sh and smoke.sh pass on both versions.

🤖 Generated with Claude Code

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>
@chrisdoehring
chrisdoehring merged commit 438715d into main Sep 29, 2026
5 checks passed
@chrisdoehring
chrisdoehring deleted the fix/keycloak-login-vertical-centering branch September 29, 2026 20:11
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.

1 participant