Add accessibility to /learn section of Lichess by zersiax · Pull Request #20552 · lichess-org/lila · GitHub
Skip to content

Add accessibility to /learn section of Lichess#20552

Open
zersiax wants to merge 10 commits into
lichess-org:masterfrom
zersiax:learn-nvui
Open

Add accessibility to /learn section of Lichess#20552
zersiax wants to merge 10 commits into
lichess-org:masterfrom
zersiax:learn-nvui

Conversation

@zersiax

@zersiax zersiax commented May 28, 2026

Copy link
Copy Markdown

The problem

Lichess is one of the most accessible chess websites for people using a screen reader, leaving competitors far behind where the screen reader-specific experience is concerned.
There has, historically, been one big gap particularly for new players, and that is the tutorials at /learn.
While I feel these would be a great way for new players to develop board orientation, spatial awareness around the pieces etc., they were never included in the accessibility offerings that cover live play, analysis and puzzle screens so far, and haven't been for a number of years.

My attempt

I'll be the first to admit my Scala is very rusty, so I tried to touch that side of things as little as possible. I'd be happy to make changes if required.
I essentially used the accessibility work on the puzzle screen as my example, copied it as far as I was able and then added tutorial-specific fixes within the actual UI. I tried to stick to code conventions I saw used in other parts of the codebase to keep the codebase consistent.
Basically, this adds:

  • star announcement on squares that have a star on them to collect;
  • verbalization of the visual hint arrows on the board when present
  • screen reader announcements of moves being played, move count counting down and stars being collected
  • Made sure arrow navigation across the board works as expected like the other modes let you do.
  • Made the stage complete screen a bit more accessible.

testing

I spun up lila-docker on a macbook pro and tested the changes live as I was making them, using a Windows browser with NVDA (screen reader) running. I can confirm these changes work as intended in that sense (see caveats below). If a testing video if required I can do that.

Caveats

I myself am a blind screen reader user, and I based how the tutorials work on what I could glean from the code. If there are other visual inicators that would be useful to add I didn't find them, but would be happy to add them if someone can point them out.
Similarly, I have tested the screen reader experience thoroughly, but may have missed unintended visual changes. I'm open to feedback on getting this experience merged so others can benefit from them.

@fitztrev fitztrev requested a review from yafred May 29, 2026 03:02
@fitztrev fitztrev added the nvui Non-Visual UI (or Blind Mode) for accessibility label May 29, 2026
@yafred

yafred commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@yafred

yafred commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

I went through the whole first stage (the rook).
The transition to the next stage is not implemented.

In the visual interface, you have 2 options:

  1. Next: the bishop
  2. Back to menu

Let me know if you need some assistance

@zersiax

zersiax commented Jun 2, 2026

Copy link
Copy Markdown
Author

In my tests, the buttons for next and back to menu appear at the bottom of the DOM after a stage has passed. I will try to reproduce and implement a fix if necessary.

@zersiax

zersiax commented Jun 2, 2026

Copy link
Copy Markdown
Author

Looks like something fell over when implementing latest master at some point. I've fixed it, the branch as it is currently properly renders the stage complete screen for me

zersiax added 6 commits June 3, 2026 01:11
Adds a parallel `learn.nvui` bundle gated on `site.blindMode`, mirroring
the puzzle/round/analyse pattern. First cut covers stage map, goal,
text board, move form, status, last move, settings and basic board
commands. Apple announcements, scenario chaining and promotion input
are not yet wired up.
Adds an aria-live polite "Apples" section listing remaining apple squares
on apple levels — the diff is announced as squares are collected.

For promotion moves, parses the role from the 5-char UCI returned by
inputToMove and resolves the parked promotion via promotionCtrl.finish,
skipping the visual-only piece picker.
Wraps the rendered board in a hooked div and attaches the standard
nvui handlers: arrow-key navigation, piece-jump letters, rank-jump
digits, click-to-select, 'o' to announce the current square, 'm' to
list possible moves from the focused square, and 'i' to focus the
move input. Adds the .boardstatus aria-live region the handlers
write into.
- Pass orig/dest to setFen on player moves so ground.state.lastMove is
  preserved and the last-move aria-live region updates correctly
- Replace shared boardCommands() (which requires i18n.keyboardMove and
  includes a clock command irrelevant to learn) with an inline list of
  the commands that actually apply
- Add renderStageComplete: when stageCompleted() is true, replace the
  board view with an assertive aria-live announcement, completion text,
  and Next/Back to menu navigation buttons
- Use hl() from lib/view instead of h() from snabbdom, matching the
  codebase convention used in puzzle.nvui
- Import VNode from lib/view; drop the snabbdom import
- Use Api directly instead of aliasing it as CgApi
- Remove role="status" from assertive aria-live regions; role="status"
  implies polite and contradicts aria-live="assertive"
Blueprint shapes (arrows/circles drawn on the board to guide the player)
are invisible to screen reader users. Translate them to a Hints section:
green arrows become "a1 to c1", red arrows "Threat: e5 to a1", blue
arrows (stalemate escape squares) "Cover: e3 to a7", circles just the
square name. Section is omitted when a level has no shapes.
@zersiax zersiax force-pushed the learn-nvui branch 2 times, most recently from 1638166 to 99ec8ac Compare June 3, 2026 23:56
@ikrami1

ikrami1 commented Jun 4, 2026 via email

Copy link
Copy Markdown

@yafred

yafred commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@zersiax I just realized some buttons are not visible (for sighted) and can only be discovered with the screen reader ... I had a second go and I can go to bishops when I complete rooks.

@ikrami1 I'll setup a test platform so that you can see where we are

@zersiax

zersiax commented Jun 4, 2026

Copy link
Copy Markdown
Author

@yafred Would you like me to make these visible for non-screen reader users? I wasn't sure if this way would be best, or if we should somehow reuse the visual on screen instead. Either way I think it works.
I also tightened up the linting to make that linter check pass and should be all good now. Do you need me to add anything more to this?

@ikrami1 Right now, the Learn section essentially teaches users chess moves and manoeuvers by having the player collect stars off the chessboard with a single type of piece, to teach how the piece moves, or by resolving a preset situation, e.g., your king is in check, get him to safety in x moves. It doesn't really teach anything else to my knowledge, and adding more content the way you're describing would be an overall Learn effort, not so much an accessibility fix. So I'd say this PR isn't the best last-off point for that, an issue or discussion topic might be better?
I appreciate the praise, accessibility tends to be a bit of a thankless job so thanks for the vote of confidence!

@ikrami1

ikrami1 commented Jun 4, 2026 via email

Copy link
Copy Markdown

@yafred

yafred commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@zersiax don't bother about the visibility of the buttons ...

ikrami1 will certainly give his feedback himself but there is something we should fix before we go online and start improving the details.
When you land on a chapter, the goal is not announced and you have to scan the headings of the pages to get it.
Ideally, we should hear it and have a command to repeat it.

@zersiax

zersiax commented Jun 4, 2026

Copy link
Copy Markdown
Author

That's a good idea. I think hints should probably be good to read out with a command as well. I will attach those to g and h both in the command input and the board, and i noticed we're auto-skipping the initial stage intros in NVUI while they do show up on the visual side. Fixing that as well, will commit when properly tested

@zersiax

zersiax commented Jun 5, 2026

Copy link
Copy Markdown
Author

And done. Let me know if you find any other gaps @yafred

@yafred

yafred commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

That looks perfect ....

A few minor comments:

  • I would go for v instead of h for the hint. I'd like to keep h for help in the future and v is already used in puzzle to view the solution.
  • g and v should not be case sensitive (we managed to keep it that way in the other views)

I was also thinking that, may be, we should just say black pawns instead of stars. But It just occurred to me that this is inherited from the visual interface texts.

@ikrami1

ikrami1 commented Jun 5, 2026 via email

Copy link
Copy Markdown

@zersiax

zersiax commented Jun 5, 2026

Copy link
Copy Markdown
Author

@yafred I'm using stars because that is what is used in the tutorials and goal texts, e.g. "collect all the stars". I figured keeping it that way might be more uniform.
The h to v switch is no problem, I'll do that in a minute.
@ikrami1 not a bad idea re s for stars, I'll see about adding that if it doesn't clash with existing keys.

@ikrami1

ikrami1 commented Jun 5, 2026 via email

Copy link
Copy Markdown

@zersiax

zersiax commented Jun 5, 2026

Copy link
Copy Markdown
Author

Done :) @ikrami1 I was able to add your suggestion as well. @yafred h switched to v, and g, v and s are now case-insensitive commands

@ikrami1

ikrami1 commented Jun 6, 2026

Copy link
Copy Markdown

@zersiax thanks for your effort, i will be adding the below text to the blind mode tutorial, i hope you can review it and see if it needs any modifications or improvements as the author of the feature.

7. Learn: Accessible Chess Tutorials

Lichess includes a comprehensive /learn section — a series of interactive tutorials designed to teach chess basics, piece movement, and fundamental tactics to new players. This section has become fully accessible to blind and visually impaired users, closing a long-standing gap in the platform's accessibility.

The tutorials are ideal for:

  • Absolute beginners learning how each piece moves.
  • Players who are new to Blind Mode and want to practice board navigation in a low-pressure environment.
  • Anyone who wants to reinforce chess fundamentals through guided, interactive exercises.

For many blind users, learning chess online has been challenging because most tutorials rely on visual diagrams, arrows, and highlighted squares. The accessible Learn section changes this by:

  • Teaching board orientation in a structured, forgiving environment.
  • Building muscle memory for keyboard navigation and piece movement.
  • Providing immediate audio feedback for every action — collecting a star, making a legal move, or completing a stage.
  • Bridging the gap between knowing chess rules and feeling confident enough to play real games.

Whether you are completely new to chess or an experienced player who wants to explore variants or practice specific piece movements, the Learn section is now a fully accessible gateway to the game.

The Learn section is organized into several categories and stages, each teaching a specific chess concept through interactive exercises:

  • Piece movement – How the rook, bishop, queen, king, knight, and pawn move.
  • Fundamentals – Capturing, protecting pieces, giving check, escaping check, and checkmate in one.
  • Intermediate skills – Board setup, castling, en passant, and stalemate.
  • Advanced tactics – Piece values and delivering check in two moves.

Each stage presents a chessboard with a specific goal — usually to collect all stars by moving a designated piece to each starred square, or to resolve a situation in a limited number of moves (e.g., get your king out of check).

7.1. Accessing the Learn Section

  1. From the Lichess homepage, press H until you reach the "Learn" heading (usually heading level 2).
  2. Arrow down to find the "Chess basics" link and press Enter.
  3. On the Learn landing page, you will find a list of stages. Use arrow keys or H headings to browse them.
  4. Press Enter on a stage to begin.

7.2. Tutorial Interface and Navigation

When you open a tutorial stage, the interface will feel familiar — it closely resembles the puzzle and analysis screens, with some important differences:

  • Page heading level 1: Displays the stage name, e.g., "The Rook".
  • Goal: Below the heading, you will find a description of the objective, e.g., "Collect all the stars in 1 move" or "Get your king to safety in 2 moves".
  • hint: a tip telling you what to move and where.
  • stars: tells you how many stars remainingg for you to collect and their exact locations on the board.
  • Pieces section: Lists all pieces on the board, as in standard games.
  • Game status: Indicates whether you are still solving, have completed the stage, or have made an incorrect move.
  • Command input field: Works exactly like in games and puzzles. Type algebraic notation to make a move.
  • Chessboard: Fully accessible. Navigate with arrow keys, select pieces with Space, and make moves by pressing Space again on a destination square.

7.3. Tutorial-Specific Features and Commands

When you are focused on the chessboard, make sure your screen reader is in Focus Mode (e.g., NVDA+Space). Then you can navigate the board grid normally using arrow keys.

The Learn section introduces several new concepts and keyboard commands tailored to the tutorial experience:

Collecting Stars

  • Stars appear on certain squares on the board. Your goal is to move the designated piece onto each starred square.
  • When you land on a square containing a star, your screen reader will announce: "Star" followed by the piece collor and name. The star then disappears.
  • The board updates automatically. You can press S (for Stars) at any time to hear:
    • How many stars remain.
    • The locations of all remaining stars (announced as a list of square names).
  • V (Hint) – Provides a spoken hint, such as which piece or square to try.
  • G (Goal) – Repeats the objective of the current stage (e.g., "Collect all stars in 2 moves").

You can also type any of these commands into the command input field (the edit box labeled "Your move" or "Command input"). Just type the letter (s, v, or g) and press Enter. The result will be spoken exactly as if you had pressed the key while on the board. All three commands are case‑insensitive (s or S, etc.).

Stage Completion

When you successfully complete a stage:

  • Your screen reader will announce the success message (e.g., "Stage complete!").
  • A "Next" button and a "Back to menu" button appear at the bottom of the page.
  • Press B or tab to reach the "Next" button to continue to the next stage, or "Back to menu" to return to the stage list.

Important Notes for Learn Mode

  • No engine analysis: The Learn section does not include computer evaluation or "best move" suggestions. The hint (V) provides guidance designed by the tutorial authors, not Stockfish.
  • No rating or time pressure: Tutorials are unrated and untimed. Take as long as you need.
  • Mistakes: If you make an illegal move or a move that does not progress the objective, you will hear an error message. Some stages allow unlimited attempts; others may reset after a certain number of wrong moves (the goal announcement will clarify).

@yafred

yafred commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

@ikrami1 for the documentation, we can proceed as usual. When you hare happy with the content, you can send the markdown to me so that we compare it to https://github.com/yafred/lichess-blind-mode/tree/master/docs/_pages before I update the Lichess page

@yafred yafred left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fine with me and @ikrami1

@zersiax

zersiax commented Jun 6, 2026

Copy link
Copy Markdown
Author

LGTM @ikrami1 , feel free to proceed

@zersiax

zersiax commented Jun 10, 2026

Copy link
Copy Markdown
Author

Just quickly checking in, are we waiting on me currently? The docs were written by @ikrami1 and the code is all done, just making sure there's no miscommunication happening :)

@ikrami1

ikrami1 commented Jun 10, 2026

Copy link
Copy Markdown

As I understand it, the next step is for a Lichess maintainer to review the pull request and merge it when they have time. I’m not sure how long that usually takes, but in my experience Lichess tends to review and merge contributions fairly quickly.

Your work is important, necessary, and genuinely valuable for both blind learners and the people who teach and support them. From my testing, the feature works flawlessly and is ready to be used.

Perhaps @ornicar is simply busy with other priorities at the moment and hasn’t had a chance to review it yet. Hopefully it will get the attention it deserves soon.

@yafred

yafred commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nvui Non-Visual UI (or Blind Mode) for accessibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants