Conversation
fix(VE-4232): implement data-cslp mutation observer to manage unique IDs for elements
…ed path If there is a button element on the composed path, then the browser will send a click event on the button when space key is pressed. stopPropagation does not work as this is not a propagated event but something done by the browser. So, whenever a button is detected on the event's composed path, use custom space key handling.
…nside-button fix: space key handling for editable elements inside button
…nside-button fix(VE-5803): sync field after custom space handling
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
This pull request introduces several updates and improvements to the
visualBuildermodule, focusing on handling duplicate elements, improving event handling, and enhancing test coverage. The changes include adding unique identifiers for duplicate elements, refining keydown handling for content-editable fields, and updating test cases to ensure robustness.FIxes
Handling Duplicate Elements:
src/visualBuilder/listeners/mouseClick.tsto assign unique IDs (data-cslp-unique-id) to elements with duplicatedata-cslpattributes, enabling more precise identification in functions likeupdateFocussedState.Event Handling Enhancements:
src/visualBuilder/utils/handleFieldMouseDown.tsto handleSpacekey events in buttons more effectively, including syncing the field state using a throttled function. [1] [2]src/visualBuilder/utils/updateFocussedState.tsto prioritizedata-cslp-unique-idoverdata-cslpwhen identifying elements, ensuring accurate focus updates. [1] [2]Testing
src/visualBuilder/utils/__test__/handleFieldMouseDown.test.tsto verify handling ofSpacekey events in both buttons and nested content-editable spans, ensuring proper event handling and field synchronization. [1] [2]crypto.randomUUIDinsrc/visualBuilder/__test__/index.test.ts.