Merge pull request #9316 from 370417/analysis-commands

Fix nvui analysis commands
pull/9317/head
Thibault Duplessis 2021-06-30 09:20:38 +02:00 committed by GitHub
commit 63e3767918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import {
positionJumpHandler,
pieceJumpingHandler,
Style,
lastCapturedCommandHandler,
} from 'nvui/chess';
import { renderSetting } from 'nvui/setting';
import { Notify } from 'nvui/notify';
@ -86,7 +87,7 @@ lichess.AnalyseNVUI = function (redraw: Redraw) {
h('div.pieces', renderPieces(ctrl.chessground.state.pieces, style)),
h('h2', 'Current position'),
h(
'p.position',
'p.position.lastMove',
{
attrs: {
'aria-live': 'assertive',
@ -137,8 +138,11 @@ lichess.AnalyseNVUI = function (redraw: Redraw) {
const $board = $(el.elm as HTMLElement);
$board.on('keypress', boardCommandsHandler());
const $buttons = $board.find('button');
const steps = () => ctrl.tree.getNodeList(ctrl.path);
const fenSteps = () => steps().map(step => step.fen);
$buttons.on('click', selectionHandler(ctrl.data.opponent.color, selectSound));
$buttons.on('keydown', arrowKeyHandler(ctrl.data.player.color, borderSound));
$buttons.on('keypress', lastCapturedCommandHandler(fenSteps, pieceStyle.get(), prefixStyle.get()));
$buttons.on('keypress', positionJumpHandler());
$buttons.on('keypress', pieceJumpingHandler(wrapSound, errorSound));
},
@ -153,6 +157,16 @@ lichess.AnalyseNVUI = function (redraw: Redraw) {
boardStyle.get()
)
),
h(
'div.boardstatus',
{
attrs: {
'aria-live': 'polite',
'aria-atomic': 'true',
},
},
''
),
h('div.content', {
hook: {
insert: vnode => {