Skip to content

Reduce feedback form layout shift#458

Merged
thibaudcolas merged 2 commits into
mainfrom
copilot/wagtail-251-reduce-layout-shift
Jul 9, 2026
Merged

Reduce feedback form layout shift#458
thibaudcolas merged 2 commits into
mainfrom
copilot/wagtail-251-reduce-layout-shift

Conversation

Copilot AI commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Clicking the happy/unhappy feedback buttons caused a layout shift because the follow-up form used display: none → block, removing it from document flow until revealed.

Change

Swap display toggle for visibility + opacity on .feedback__form:

// Before
&__form {
    display: none;
    &.active { display: block; }
}

// After
&__form {
    visibility: hidden;
    opacity: 0;
    transition: opacity $transition;
    &.active {
        visibility: visible;
        opacity: 1;
    }
}

visibility: hidden keeps the element in the document flow, so its space is always reserved below the buttons. When a button is clicked the existing JS adds the active class and the form fades in (0.25s ease-out) without shifting any surrounding content.

AI-generated contribution — changes were produced with GitHub Copilot Coding Agent.

Copilot AI linked an issue Jul 4, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Reduce layout shift on feedback form reveal Reduce feedback form layout shift Jul 4, 2026
Copilot AI requested a review from thibaudcolas July 4, 2026 06:42
@thibaudcolas
thibaudcolas marked this pull request as ready for review July 4, 2026 06:57
Copilot AI review requested due to automatic review settings July 4, 2026 06:57

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.

Pull request overview

This PR aims to reduce layout shift (CLS) in the page feedback component when users click the happy/unhappy buttons by keeping the follow-up form’s space reserved in the document flow and fading it in via opacity.

Changes:

  • Replace display: none/block toggling on .feedback__form with visibility + opacity.
  • Add an opacity transition to smoothly reveal the form when the existing JS adds the active class.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@thibaudcolas
thibaudcolas merged commit c3826f6 into main Jul 9, 2026
5 of 7 checks passed
@thibaudcolas
thibaudcolas deleted the copilot/wagtail-251-reduce-layout-shift branch July 9, 2026 05:39
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.

Feedback form reveal animation

3 participants