Skip to content

NVUI Round Additions #7772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 50 commits into from
Jan 14, 2021
Merged

NVUI Round Additions #7772

merged 50 commits into from
Jan 14, 2021

Conversation

TTWNO
Copy link
Contributor

@TTWNO TTWNO commented Dec 23, 2020

Change board in NVUI interface to be navigable on its own.

It does not implement all features of the text input box interface, yet. But I'm working on that. If I could have anyone using a screen reader, or anyone on the accessibility threads test these changes, that would be fantastic.

A live version of this branch is available on https://chess.tait.tech/

Also looking at analysis board and the ability to get information about pieces which can attack/protect certain squares. A sighted player will see their rook is being attacked on the long diagonal, but a novice visually impaired player who does not play in their head will likely not see that. Looking into server-side changes to allow this information to be sent to the client.

Thanks for the great site!

I will ping a few issues and users who seem to care about this.

#7084 #6401

@kraktus @montalvonet

@TTWNO TTWNO changed the title Nvui table board NVUI Round Additions Dec 23, 2020
Copy link
Collaborator

@ornicar ornicar left a comment

Choose a reason for hiding this comment

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

Interesting. I'd like visually impaired players to weight on this.
Writing new features is fun, but maintaining them for years and years to come is not. And I'll very probably be the one doing it. So for every feature I must be very sure that they're worth the cost, and that enough people use them.
I developed the current NVUI in collaboration with visually impaired players, and they never mentioned something like this.

Where do the sounds come from?

@@ -0,0 +1,5 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

please ignore these filenames with global gitiginore in ~/.gitconfig

ui/build Outdated
@@ -56,7 +56,7 @@ if [ $mode == "css" ]; then
else
if type -p parallel; then # parallel execution!
if [ -z "$P_OPTS" -a ! -e ~/.parallel/config ]; then
P_OPTS="-j+4 --halt 2"
P_OPTS="-j+12 --halt 2"
Copy link
Collaborator

Choose a reason for hiding this comment

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

no, please don't commit that

@@ -6,3 +6,7 @@ export const move = throttled('move');
export const capture = throttled('capture');
export const check = throttled('check');
export const explode = throttled('explosion');
export const select = throttled('select');
Copy link
Collaborator

Choose a reason for hiding this comment

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

keep these in the nvui files to avoid tainting the main gameplay code

@TTWNO
Copy link
Contributor Author

TTWNO commented Dec 24, 2020

The sounds come from a GPLv2 project: Emacspeak. An Emacs extention for speech output.

I added this for the casual low-vision user. Someone who is not good at chess, or even doesn't know the rules very well. I have heard from a few of my friends with screenreaders that being able to navigate around a board is more intuitive when learning something new. That's also why I left the already implemented nvui the way it is.

Sorry about committing those settings files and compile options. Should be fixed right away.

@ornicar
Copy link
Collaborator

ornicar commented Dec 28, 2020

Hmm I'm getting compilation errors:

cd ui/round
yarn plugin-dev nvui
yarn run v1.22.10
$ rollup --config --config-plugin nvui

src/plugins/nvui.ts → ../../public/compiled/round.nvui.js...
(!) Plugin typescript: @rollup/plugin-typescript TS6133: 'lastCaptured' is declared but its value is never read.
src/plugins/nvui.ts: (15:122)

15 import { renderSan, renderPieces, renderBoard, styleSetting, pieceSetting, prefixSetting, positionSetting, boardSetting, lastCaptured, PieceStyle, PrefixStyle } from 'nvui/chess';
                                                                                                                            ~~~~~~~~~~~~

(!) Plugin typescript: @rollup/plugin-typescript TS6133: 'PieceStyle' is declared but its value is never read.
src/plugins/nvui.ts: (15:136)

15 import { renderSan, renderPieces, renderBoard, styleSetting, pieceSetting, prefixSetting, positionSetting, boardSetting, lastCaptured, PieceStyle, PrefixStyle } from 'nvui/chess';
                                                                                                                                          ~~~~~~~~~~

(!) Plugin typescript: @rollup/plugin-typescript TS6133: 'PrefixStyle' is declared but its value is never read.
src/plugins/nvui.ts: (15:148)

15 import { renderSan, renderPieces, renderBoard, styleSetting, pieceSetting, prefixSetting, positionSetting, boardSetting, lastCaptured, PieceStyle, PrefixStyle } from 'nvui/chess';
                                                                                                                                                      ~~~~~~~~~~~

(!) Plugin typescript: @rollup/plugin-typescript TS6133: 'symbolToFile' is declared but its value is never read.
src/plugins/nvui.ts: (19:53)

19 import { castlingFlavours, supportedVariant, Style, symbolToFile, roundBoardListenersSetup } from 'nvui/chess';
                                                       ~~~~~~~~~~~~

(!) Plugin typescript: @rollup/plugin-typescript TS2305: Module '"../../../../node_modules/nvui/chess"' has no exported member 'roundBoardListenersSetup'.
src/plugins/nvui.ts: (19:67)

19 import { castlingFlavours, supportedVariant, Style, symbolToFile, roundBoardListenersSetup } from 'nvui/chess';
                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~

(!) Plugin typescript: @rollup/plugin-typescript TS6133: 'roundBoardListenersSetup' is declared but its value is never read.
src/plugins/nvui.ts: (19:67)

19 import { castlingFlavours, supportedVariant, Style, symbolToFile, roundBoardListenersSetup } from 'nvui/chess';
                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~

(!) Plugin typescript: @rollup/plugin-typescript TS6133: 'TourStandingCtrl' is declared but its value is never read.
src/plugins/nvui.ts: (21:1)

21 import { TourStandingCtrl } from '../tourStanding';
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(!) Plugin typescript: @rollup/plugin-typescript TS2345: Argument of type 'Setting<PieceStyle>' is not assignable to parameter of type 'PieceStyle'.
  Type 'Setting<PieceStyle>' is not assignable to type '"white uppercase name"'.
src/plugins/nvui.ts: (132:107)

132             $board.on('keypress', lastCapturedCommandHandler(() => ctrl.data.steps.map(step => step.fen), pieceStyle, prefixStyle));
                                                                                                              ~~~~~~~~~~

(!) Plugin typescript: @rollup/plugin-typescript TS2322: Type 'string | { [key: string]: string; } | undefined' is not assignable to type 'string | { [key: string]: string; }'.
  Type 'undefined' is not assignable to type 'string | { [key: string]: string; }'.
src/plugins/nvui.ts: (136:64)

136             $buttons.on('keypress', possibleMovesHandler(() => ctrl.data.possibleMoves, () => ctrl.chessground.state.pieces));
                                                                   ~~~~~~~~~~~~~~~~~~~~~~~

  ../nvui/chess.d.ts:32:61
    32 export declare function possibleMovesHandler(possibleMoves: () => string | {
                                                                   ~~~~~~~~~~~~~~~~
    33     [key: string]: string;
       ~~~~~~~~~~~~~~~~~~~~~~~~~~
    34 }, pieces: () => Pieces): (ev: KeyboardEvent) => boolean;
       ~
    The expected type comes from the return type of this signature.

Also I see changes in ui/analyse, but I thought this PR was about gameplay only? It should be.

Finally, the opponent legal moves aren't sent to save (a lot of) bandwidth. That won't change. If you need them, you could add a dependency to chessops to generate them on client side.

@TTWNO
Copy link
Contributor Author

TTWNO commented Dec 28, 2020

Also I see changes in ui/analyse, but I thought this PR was about gameplay only? It should be.

The event listeners on the rendered nvui board for analysis are different from the ones for playing an actual game. You pointed out that the analysis board was broken; I fixed it by not initializing an event listener which is compatible with RoundData only, and not AnalyseData.

Hopefully that makes sense.

Working on compile errors now.

@TTWNO
Copy link
Contributor Author

TTWNO commented Dec 30, 2020

The selectionHandler and pieceJumpingHandler depend on functionality from the other to properly handle choosing a piece for promotion.
A promotion="true" attribute is added to the destination button, then an aria-live notification tells the user to use q/n/b/r to select their promotion piece. Once a valid key is pressed, it removes the promotion attribute from the button, restoring normal piece jumping functionality to the square.

EDIT: Any suggestions on how to make this better? I feel like coupling two handlers like that isn't the right way.

@ornicar
Copy link
Collaborator

ornicar commented Jan 13, 2021

If I merge this, do you plan on maintaining it?

@TTWNO
Copy link
Contributor Author

TTWNO commented Jan 14, 2021

Yes, sir!

console.log(uci);
console.log(uci.slice(0, -1));
console.log(promotion);
console.log(legalSans);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this debug should probably be removed now

@ornicar
Copy link
Collaborator

ornicar commented Jan 14, 2021

alright then, here goes nothin!

@ornicar ornicar merged commit 51d8f38 into lichess-org:master Jan 14, 2021
@ornicar
Copy link
Collaborator

ornicar commented Jan 14, 2021

Feel free to join our dev discord server: https://discord.gg/pw6Efvk

Could be useful to discuss follow-up on this feature.

@ornicar
Copy link
Collaborator

ornicar commented Jan 14, 2021

the changes are online

@montalvonet
Copy link

montalvonet commented Jan 15, 2021 via email

@TTWNO
Copy link
Contributor Author

TTWNO commented Jan 15, 2021

@montalvonet

  1. Make the board navigable by specialized keyboard commands. Make sure to disable browse mode to use this. The keys must be passed through to the browser directly. Go under the level 2 header "board" to use these features.
  2. There are 4 settings as to how the board should be rendered, check them out under the "board settings" level 3 header.
  3. Finally, under the level 2 header "board commands" there is a list of all the keys that may be used with the new additions.

Even though pawn promotion is not mentioned in the list of commands, it does work. However, it overrides the "piece jumping" functionality for the destination.

To give an example: normally n/b/r/q/k will take you to the next knight/bishop/rook/queen/king, but when you move a pawn from let's say a7 to a8, now a8 will not jump around with those letters, but rather those letters become the piece you want to promote to. You may still use piece jumping by going left or right from the pawn promotion destination tile and continue browsing the board. But that destination square, a8, is whwre your focus must be if you want to promote your pawn.

Hope that makes sense.

@montalvonet
Copy link

montalvonet commented Jan 15, 2021 via email

@TTWNO
Copy link
Contributor Author

TTWNO commented Jan 15, 2021

@montalvonet That is correct. To submit a move using standard notation, you must move back to the "your move" input box and submit your move there.

If you would like a key which can move you to the input box automatically, please make an issue for it with descriptions about which key should bring you to the input box, and which key should bring you back. The more detail I have from you, the easier it is for me to make a patch.

Please make a new issue if you wish to discuss this further.

@montalvonet
Copy link

montalvonet commented Jan 16, 2021 via email

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.

5 participants