Skip to content

feat(ui-global-nav): add loading and error states to the SubNav - #2841

Open
balzss wants to merge 1 commit into
masterfrom
feat/global-nav-subnav-states
Open

balzss wants to merge 1 commit into
masterfrom
feat/global-nav-subnav-states

Conversation

@balzss

@balzss balzss commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A SubNav (any level) takes a status: a loading screen that waits 400 ms so a fast load doesn't flicker, or an error with an optional retry button. 400 ms is the default announcementDelay of SkeletonLoader, so both loading screens wait the same time. It replaces items or renderContent. Screen readers hear the loading text, the error (role="alert") and loadedLabel from live regions in the SubNav level, as in SkeletonLoader. Empty lists stay the app's own content in renderContent.
  • When new content removes the focused element (for example the retry button), focus moves to the first item, else the close handle. Content arriving doesn't move focus.
  • renderFooter adds content under the scrolling area, for "All X" links or pagination.
  • onRequestSubNavContent is called when the SubNav of a rail item or the account opens, and earlier after 200 ms of hover or focus, or on touch. The delay skips the pointer or focus only passing over an item, and about 200 ms is what Canvas suggested for starting its lazy loads. Prior art: Pagination's onMouseEnter was added for prefetching (INSTUI-4678). GlobalNav adds the delay and focus because users pass over the rail all the time.

Three basic tests. Full tests and accessibility checks come with INSTUI-5235.

Test Plan

GlobalNav page, "Loading and errors" example:

  • Open Courses: a spinner after 400 ms, then the items. Focus stays on the close button. "All courses" stays at the bottom.
  • Open Groups: an error with "Try again". Tab to it and press Enter: focus moves to the close button, then the groups show.
  • With a screen reader: the loading text, the error and "Courses loaded" are read once each.
  • Hover Courses for a moment before clicking (on a fresh page): the items show without the spinner.

Fixes INSTUI-5280

🤖 Generated with Claude Code

@balzss balzss self-assigned this Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.2

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2841/

Built to branch gh-pages at 2026-12-04 11:23 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

github-actions Bot pushed a commit that referenced this pull request Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Visual regression report

Cypress suite: ✅ Passing

Visual diff: ⚠️ Changes detected.

Status Count
Unchanged 110
Changed 1
New 0
Removed 0

Accessibility (axe): ✅ No violations.

📊 View full report — click a screenshot's ⚠ badge to see each violation boxed on the image, with the offending element named and contrast failures shown as color swatches.

Diff images (1)

tooltip-light.png — 15266 pixels differ

Baselines come from the visual-baselines branch. They refresh on every merge to master. The Cypress suite line covers the a11y and console-error assertions — a ❌ there means the suite found real issues even if the visual diff is clean.

@balzss
balzss force-pushed the feat/global-nav-subnav-states branch from 1e078db to 31036e9 Compare December 2, 2026 11:45
@balzss balzss changed the title feat(ui-global-nav): add loading, error and empty states to the SubNav feat(ui-global-nav): add loading and error states to the SubNav Dec 2, 2026
github-actions Bot pushed a commit that referenced this pull request Dec 2, 2026
@balzss
balzss force-pushed the feat/global-nav-subnav-states branch from 31036e9 to 0b3f6af Compare December 2, 2026 15:24
github-actions Bot pushed a commit that referenced this pull request Dec 2, 2026
@balzss
balzss force-pushed the feat/global-nav-subnav-states branch from 0b3f6af to 230515c Compare December 4, 2026 09:45
github-actions Bot pushed a commit that referenced this pull request Dec 4, 2026
@balzss
balzss force-pushed the feat/global-nav-subnav-states branch from 230515c to aafcdbe Compare December 4, 2026 09:52
@balzss
balzss marked this pull request as ready for review December 4, 2026 09:56
github-actions Bot pushed a commit that referenced this pull request Dec 4, 2026
@balzss
balzss requested a review from matyasf December 4, 2026 11:14
Canvas loads Courses, Groups, History and Help in the background, so
it needs to show progress and a failed load without building these
screens in renderContent. An empty list stays the app's own content.
onRequestSubNavContent tells it when to load, starting before the
click, and renderFooter holds pagination for long lists.

Refs INSTUI-5280

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@balzss
balzss force-pushed the feat/global-nav-subnav-states branch from aafcdbe to 42a0971 Compare December 4, 2026 11:19
github-actions Bot pushed a commit that referenced this pull request Dec 4, 2026
Comment on lines +201 to +206
{subNav.status ? (
<SubNavStatus
// a new screen remounts, which restarts the loading delay and announces it again
key={subNav.status.type}
status={subNav.status}
/>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So as I see this is the core part: if status is not undefined, then show the loading/error screen, and the content otherwise

@matyasf matyasf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it looks good, I think the core logic is OK, did not go very deep on the whole thing though

This branch has not been deployed

No deployments
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.

2 participants