Fix #17563: NVUI - board becomes unresponsive after layout change#20074
Merged
ornicar merged 1 commit intolichess-org:masterfrom Mar 23, 2026
Merged
Fix #17563: NVUI - board becomes unresponsive after layout change#20074ornicar merged 1 commit intolichess-org:masterfrom
ornicar merged 1 commit intolichess-org:masterfrom
Conversation
… change The board stopped responding to clicks and keyboard input after changing the layout in NVUI mode. This happened because event listeners were bound directly to button elements, which were destroyed and recreated during re-render, causing the listeners to be lost. Replaced direct event binding with delegated events attached to the board container to ensure handlers persist across DOM updates. Added namespaced event cleanup to prevent duplicate bindings. Also updated the render hook to call boardEventsHook on both insert and update, ensuring events are consistently reattached after every re-render.
Contributor
|
Thanks for the fix ... and, even better, for the PR style (so easy to review) As for the nvui part, I confirm it solves the problem ... There are 2 other boards that use the same model
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #17563: NVUI board becomes unresponsive after layout change
The board stopped responding to clicks and keyboard input after changing the layout in NVUI mode. This happened because event listeners were bound directly to button elements, which were destroyed and recreated during re-render, causing the listeners to be lost.
Fix
Replaced direct event binding with delegated events attached to the board container to ensure handlers persist across DOM updates.
Added namespaced event cleanup using
$board.off('.nvui')to prevent duplicate bindings when the hook runs multiple times.Updated the render hook to call
boardEventsHookon bothinsertandupdate, ensuring events are consistently reattached after every re-render.Testing
Manually tested by:
Also ran all frontend tests and confirmed they pass.
Demo / Video
A short video demonstrating the bug and explaining the changes:
Watch the video