Skip to content

Stage-v3.2.1#428

Merged
faraazb merged 14 commits intostage_v3from
develop_v3
Apr 22, 2025
Merged

Stage-v3.2.1#428
faraazb merged 14 commits intostage_v3from
develop_v3

Conversation

@faraazb
Copy link
Copy Markdown
Contributor

@faraazb faraazb commented Apr 22, 2025

This pull request introduces several updates and improvements to the visualBuilder module, 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:

  • Added logic in src/visualBuilder/listeners/mouseClick.ts to assign unique IDs (data-cslp-unique-id) to elements with duplicate data-cslp attributes, enabling more precise identification in functions like updateFocussedState.

Event Handling Enhancements:

  • Updated src/visualBuilder/utils/handleFieldMouseDown.ts to handle Space key events in buttons more effectively, including syncing the field state using a throttled function. [1] [2]
  • Modified src/visualBuilder/utils/updateFocussedState.ts to prioritize data-cslp-unique-id over data-cslp when identifying elements, ensuring accurate focus updates. [1] [2]

Testing

  • Added new test cases in src/visualBuilder/utils/__test__/handleFieldMouseDown.test.ts to verify handling of Space key events in both buttons and nested content-editable spans, ensuring proper event handling and field synchronization. [1] [2]
  • Increased test reliability by mocking crypto.randomUUID in src/visualBuilder/__test__/index.test.ts.

sairajchouhan and others added 9 commits April 14, 2025 13:22
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
@faraazb faraazb requested a review from a team as a code owner April 22, 2025 06:25
@faraazb faraazb assigned csAyushDubey and unassigned csAyushDubey Apr 22, 2025
@faraazb faraazb requested a review from csAyushDubey April 22, 2025 06:26
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 70.11% 8152 / 11627
🔵 Statements 70.11% 8152 / 11627
🔵 Functions 68.03% 281 / 413
🔵 Branches 84.57% 987 / 1167
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/visualBuilder/index.ts 56.2% 66.66% 42.85% 56.2% 92-99, 102-106, 109-121, 124-197, 203-237, 245-267, 318-321, 324-325
src/visualBuilder/listeners/mouseClick.ts 75.1% 82.05% 90.9% 75.1% 102-103, 106-111, 124-152, 178-179, 224, 282-288, 308-314, 332-342
src/visualBuilder/utils/handleFieldMouseDown.ts 100% 92.59% 100% 100%
src/visualBuilder/utils/updateFocussedState.ts 53.95% 59.61% 100% 53.95% 43, 55-57, 59-61, 63, 178-181, 183-214, 301-305, 308-325, 328-338, 341-358, 365-410, 417-439, 445-447
Generated in workflow #389 for commit 063f81a by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@sairajchouhan sairajchouhan left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@hiteshshetty-dev hiteshshetty-dev left a comment

Choose a reason for hiding this comment

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

LGTM!!

Comment thread src/visualBuilder/listeners/mouseClick.ts Outdated
Comment thread src/visualBuilder/utils/updateFocussedState.ts Outdated
Copy link
Copy Markdown
Contributor

@hiteshshetty-dev hiteshshetty-dev left a comment

Choose a reason for hiding this comment

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

LGTM!!

@faraazb faraazb merged commit ae31c57 into stage_v3 Apr 22, 2025
8 checks passed
@faraazb faraazb deleted the develop_v3 branch April 22, 2025 13:00
@faraazb faraazb restored the develop_v3 branch April 23, 2025 09:13
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.

7 participants