Skip to content

[Prototype][DNM]Adjust spinner vertical position#6615

Draft
duncanuszkay-d2l wants to merge 4 commits intomainfrom
dunk.backdrop-loading-spinner-y-pos
Draft

[Prototype][DNM]Adjust spinner vertical position#6615
duncanuszkay-d2l wants to merge 4 commits intomainfrom
dunk.backdrop-loading-spinner-y-pos

Conversation

@duncanuszkay-d2l
Copy link
Contributor

@duncanuszkay-d2l duncanuszkay-d2l commented Feb 19, 2026

https://desire2learn.atlassian.net/browse/NTNGL-5380

If you trigger the table loading state after scrolling, you won't see the loading spinner at all since it's statically positioned below the top of the element.

In this PR, I'm calculating the vertical position for the spinner each time the loading backdrop is enabled. The position is equal to the center of the visible portion of the element.

To avoid excessive recalculation and visual noise, we do not recalculate this position again until the next time the backdrop is triggered, even if the user then scrolls or resizes the page.

Functional Testing

Testing the behaviour in three scenarios:

  1. The viewport contains the element completely
  2. The element ends below the viewport
  3. The element starts above the viewport
Recording.2026-02-19.165349.mp4
  1. The element starts above and ends below the viewport
Recording.2026-02-19.165631.mp4

dlockhart and others added 3 commits February 13, 2026 15:37
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions
Copy link
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-6615/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

@duncanuszkay-d2l

This comment was marked as outdated.

@duncanuszkay-d2l duncanuszkay-d2l changed the title Adjust spinner vertical position as we scroll [Prototype][DNM]Adjust spinner vertical position as we scroll Feb 19, 2026
Comment on lines +41 to +49
<tr>
<td>Math</td>
<td class="grade">85%</td>
<td>100</td>
</tr>
<tr>
<td>Math</td>
<td class="grade">85%</td>
<td>100</td>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes the demo long enough to easily test this property

@duncanuszkay-d2l duncanuszkay-d2l force-pushed the dunk.backdrop-loading-spinner-y-pos branch from 7dc648f to 8b1e0b5 Compare February 19, 2026 21:47
Comment on lines +103 to +107
if (this.#mustRepositionSpinner) {
this.#centerLoadingSpinner();
this.#mustRepositionSpinner = false;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm using a private property here to indicate that the spinner should be repositioned after the next render- the flow looks like this:

  1. The user marks the element as 'shown'
  2. We call show(), which sets the state properties to start the fade-in, and records that we'll need to re-position after this render
  3. We render the page as a result of the properties changing (must occur first to get page dimensions before we can center)
  4. When we move onto updated we see that the spinner needs to be re-positioned, so we do so and remove the mark
  5. Future renderings, such as those that result from transitions starting/completing, don't trigger further repositioning of the spinner, even if the viewport has since moved. This is by design.

Copy link
Member

Choose a reason for hiding this comment

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

I think you could do without it and check for changedProperties having _state being set to either shown (if reduced motion) or showing (if not reduced motion)?

Base automatically changed from GAUD-9445/backdrop-loading-improvements to main February 20, 2026 18:16
@duncanuszkay-d2l duncanuszkay-d2l changed the title [Prototype][DNM]Adjust spinner vertical position as we scroll [Prototype][DNM]Adjust spinner vertical position Feb 23, 2026
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.

3 participants