-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
+Add en passant option in Board Editor #14165
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
+Add en passant option in Board Editor #14165
Conversation
* master: Add Asturian Flag, ref to lichess-org#14084 (lichess-org#14152) refactor flair picker and make it admin aware flair/list.sh add lichess flair back, for admins only move misplaced flair refactor flair picker style remove debug New Crowdin updates (lichess-org#14148) Update kamon-core, kamon-influxdb, ... to 2.7.0
ui/editor/src/ctrl.ts
Outdated
| this.redraw(); | ||
|
|
||
| //Fix En passant select bug where an option being removed breaks the select | ||
| const epSelect = $('.enpassant select')[0] as HTMLSelectElement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reading and updating the DOM from a ctrl is too much of a hack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to find another way, but I can't even manage to reproduce the bug it fixes. Can you help me with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it isn't pretty. See comment below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a lot of code, but a needed feature
ui/editor/src/ctrl.ts
Outdated
| this.redraw(); | ||
|
|
||
| //Fix En passant select bug where an option being removed breaks the select | ||
| const epSelect = $('.enpassant select')[0] as HTMLSelectElement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to find another way, but I can't even manage to reproduce the bug it fixes. Can you help me with that?
|
Hi @ornicar ! I could reproduce on Firefox/Chromium/Chrome the bug [but not in Safari], the 'selected' (attribute) element isn't shown visually [and selecting it via view.ts @ "selected" attribute (when building the 'h') doesn't visually work]. I wrote the steps in my first comment. I just re-reproduced successfully the bug : Video + img of dom-elements Screen.Recording.2023-12-06.at.1.03.57.PM.mov |
|
I just found a way to fix the bug without using those two lines. It involves the 'hidden' attribute and having all [16] possible values at all time (but hidden if unused ). Since no value is removed, it doesn't break the select. I'll commit once master and/or the branch is compilable [getting [error] -- [E046] Cyclic Error: /Users/redmba/dev/myLichess/lila/modules/common/src/main/Chronometer.scala:41:31 at the moment] to not lose your modifs. |
I had the same issue, but |
~increased to 9ch select size (for chrome)
Thanks lenguyenthanh :) ! (my bad !) I implemented the fix I mentioned earlier : using all the values being always present. A few things to note :
I hope everything is now good. Tell me if I should do other modifs. Thanks ! |
* master: show player flag on its powertip tweak team cache expiration clear LightTeam cache on flair update detect unsaved form changes, prompt the user - closes lichess-org#14095 make sure dialog is no wider than the screen, add text ellipsis fix /paste double warning, tweak style show when kid mode is enabled merge newPlayer template scala tweaks remove bad translation lego - not necessary anyway split new translations to onboarding.xml translate flair delete unused removeComputerVariations function pointlessly switch boolean tests to reduce function calls hide rather than clear server eval when analysis disabled bigger activation window for well-intentioned but occasional streamers Add translate new player landing page
|
Excellent stuff, thanks! |
Fixes #14139 .
Some notes :
Bug (fixed) mentioned on ctrl.ts#103 is when [without those 2 lines] you're loading for instance /editor/rnbqkbnr/1p4p1/6P1/4P3/2PPpPp1/1Rpp2P1/8/1NBQKBNR_b_kq_f3_0_1?color=white ; 1- selecting no en passant, 2- re-selecting f3, 3- then moving the d3 pawn to e3 and 4- moving that pawn back [then url doesn't match the "select" visual value].
I created also an issue in Have a parseCastlingFen equivalent for enPassant niklasf/chessops#154 regarding having a better en-passant check for chessops (there is a lot of stuff for castling checks, but not much for en passant). I think this could remove the need "fenFixedEp" requirement once implemented (depending on how it's done).
Note that I do not allow "half-way" values like the "ahAH" for castling. Either there is one valid en passant value in the fen, or none [or if the fen is illegal, e.g. king in check, then it makes the url differ from the select visual value; which I don't think is problematic].
Otherwise as-is I couldn't find any bug.
What it looks like :
