Skip to content

♿️(onboarding) make the steps and preview accessible - #371

Open
Ovgodd wants to merge 15 commits into
mainfrom
fix/a11y-onboarding-modal
Open

Ovgodd wants to merge 15 commits into
mainfrom
fix/a11y-onboarding-modal

Conversation

@Ovgodd

@Ovgodd Ovgodd commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Make the OnboardingModal usable with a keyboard and a screen reader:

  • steps with a preview act as vertical tabs, with correct roles, names and Tab order
  • arrows move between steps without announcing each step twice
  • Next and Previous announce the new step while the focus stays on them
  • steps accept an optional contentAlt when the preview media carries meaning
  • the footer link announces that it opens a new window

This replaces fix/a11y-onboarding-tablist, now that the Modal accessibility work is merged.

Proposal

  • Use react-aria Tabs with manual activation, like the tab variant of the Modal: arrows, Home and End move the focus; Enter, Space or a click selects the step.
  • Keep only the selected step in the Tab order; tabbing back into the list lands on the selected step.
  • Name the preview panel after the selected step; the panel is focusable only when its content is not.
  • Add an optional contentAlt on steps, exposed as the panel description.
  • Announce step changes from Next and Previous through a polite status region.
  • Remove the auto-focus on the first step at opening, to follow the Modal default.
  • Render text-only steps (hideContent, ReleaseNoteModal) as a list of buttons with aria-current="step", since there is no panel to control.
  • Show an external-link icon on the footer link and add "opens in a new window" to its name.
  • Remove the unused currentStepSuffix and contentRegionLabel translations.

Tests

Unit tests: src/components/onboarding-modal/index.spec.tsx (9 tests).

Manual tests with keyboard and NVDA, in Storybook:

Components/OnboardingModal/Many steps

  • The focus stays on the dialog at opening; NVDA announces "Learn the core principles, dialog".
  • Tab order: Close, selected step, preview, footer link, Skip, Next.
  • Arrows, Home and End move the focus only: "Format your content with the toolbar, tab 2 of 6", no description.
  • Enter and Space select the step, announced "selected", and the preview changes.
  • The preview is announced as a tab panel named after the step, then the image alternative.
  • Next keeps the focus and announces "Step 2 of 6: Format your content with the toolbar"; the last step shows "Understood".
  • Escape closes the modal.
  • The footer link shows the external-link icon and is announced "Learn more docs features (opens in a new window), link".

Components/OnboardingModal/With custom content

  • Tab goes to the "Try me" button inside the preview, not to the panel.
  • The video step is described by contentAlt in browse mode.

Components/OnboardingModal/Text only

  • No tabs and no panel; each step is a button in the Tab order.
  • The current step is announced "current step" with its description.
  • Next announces the new step.

@Ovgodd Ovgodd self-assigned this Nov 3, 2026
@Ovgodd Ovgodd added the Accessibility Accessibility Update label Nov 3, 2026
@Ovgodd
Ovgodd force-pushed the fix/a11y-onboarding-modal branch from 30fdd45 to abc3f35 Compare November 3, 2026 14:08
@Ovgodd Ovgodd changed the title Fix/a11y onboarding modal ♿️(onboarding) make the steps and preview accessible Nov 3, 2026
Describe preview media that has no text alternative of its own.
Arrow keys move focus and Enter selects, so the step is announced once.
Steps without a preview are buttons, with the current one marked.
Show an external-link icon and announce that the link opens a new window.
@PanchoutNathan
PanchoutNathan force-pushed the fix/a11y-onboarding-modal branch from abc3f35 to 21f0bcf Compare November 13, 2026 11:27

@PanchoutNathan PanchoutNathan 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.

And to make a pass because the titles aren't necessarily centered with the icons in all the variations; I have the impression that the spacing has changed compared to the old version (and it might be good, but it really takes up a lot of space) + I have the impression that the font of the descriptions has changed, or at least the weight

Capture d’écran 2026-11-13 à 13 20 17

Comment on lines -139 to -144
useEffect(() => {
const activeRef = stepRefs.current[currentStep];
if (activeRef) {
activeRef.scrollIntoView({ behavior: "smooth", block: "nearest" });
}
}, [currentStep]);

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.

Regression: the scrollIntoView effect is gone. With Next / Previous the focus stays on the button, so react-aria does not scroll the list. In the "Many steps" story, steps 4 to 6 get selected outside the visible area (scrollTop stays at 0).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

indeed, fixed it thanks

@@ -1,4 +1,18 @@
import { useState, useRef, useEffect, useCallback } from "react";
import {

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.

The preview used to depend on the active step; hasPreview is now global. With mixed steps, a step without content shows an empty tabpanel that is focusable (no tabbable child) and announced by screen readers. Do we support this case? If not, we could document it in the story ("all steps or none") and add a dev console.warn, like for initialStep.

@@ -1 +1 @@
import {

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.

When footerLink only has onClick, we render an <a> without href: no link role, not keyboard-focusable. This was already the case on main, but since the PR touches this element: we could render a <button type="button"> in that case, and keep the <a target="_blank"> (with the icon and "new window") only when there is an href. The button will need a CSS reset (background: none; border: 0; font: inherit; cursor: pointer).

@PanchoutNathan

Copy link
Copy Markdown
Collaborator
  • If you could write some end-to-end component tests for this modal, please; I don't think there are any. Also, create some good documentation. Please use well-documented and tested components as a guide! thx a lot !

@Ovgodd

Ovgodd commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

And to make a pass because the titles aren't necessarily centered with the icons in all the variations; I have the impression that the spacing has changed compared to the old version (and it might be good, but it really takes up a lot of space) + I have the impression that the font of the descriptions has changed, or at least the weight

Capture d’écran 2026-11-13 à 13 20 17

Nice catch. The icon is centered on the title again in every variant.

The icon box was 1.4em, which is based on the icon's own font size, so it only lined up with the title in Arial. It is now 1.25rem, the same length as the title line, so the center holds in every variant.

On main the steps render in Arial. The rest of the modal uses Marianne, and so does the onboarding modal on Docs.

The spacing uses the same padding as the Docs onboarding modal:
image

I also checked the weight by comparing Docs and the UI kit. The description has no specific font-weight, and the font size and line height are the same.

maybe I miss something, happy to dicuss with you about it

Comment on lines +16 to +26
.c__onboarding-modal__sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}

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.

Can"t this class be generic for all components and named sr-only?

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.

Or what about .c__offscreen that already exists?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Or what about .c__offscreen that already exists?

oh yes thanks

renderOnboarding();
const user = userEvent.setup();

const compose = await screen.findByRole("tab", { name: "Compose" });

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.

Could you add steps with a description like in this test ? https://github.com/suitenumerique/ui-kit/blob/main/packages/ui-components/e2e/la-suite-support-form/la-suite-support-form.spec.tsx#L75-L113

We try to follow this pattern in new tests, to help understand the test, thx!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

of course !

});

describe("in text-only mode", () => {
it("renders the steps as a list of buttons marking the current one", async () => {

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.

ditto ( please make a pass on all e2e test )

<div
{hasPreview && (
<TabPanel
id={String(currentStep)}

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.

During the 200ms fade, the panel is already named after the new step, but it still shows the old content and the old contentAlt. We could maybe derive aria-describedby from currentStep too, so at least name and description match?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, the description now follows the selected step like the name, with a test checking it during the fade 👍

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.

a bit too verbose to me ^^

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.

Ditto tests step, we should maybe create a skill in this repo to guide the agents

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done, every unit and e2e test now has numbered steps. I agree for a skill to guide agents on this format. could be a separate PR ?

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.

yep surely, not in this one

@Ovgodd
Ovgodd requested a review from NathanVss November 20, 2026 09:30

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

Accessibility Accessibility Update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants