Skip to content
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

fix: selection issue in table row while editing #9725

Closed
wants to merge 4 commits into from

Conversation

Kartik18g
Copy link
Collaborator

Fixes 9505

@CLAassistant
Copy link

CLAassistant commented May 15, 2024

CLA assistant check
All committers have signed the CLA.

@Kartik18g Kartik18g force-pushed the bugfix/selection-issue-in-table-row branch from 69de198 to 36584a1 Compare May 16, 2024 09:53
@Kartik18g Kartik18g marked this pull request as ready for review May 16, 2024 11:40
Copy link

@Kartik18g Kartik18g force-pushed the bugfix/selection-issue-in-table-row branch from 36584a1 to 5306ae8 Compare May 23, 2024 14:23
@Kartik18g Kartik18g changed the base branch from develop to appbuilder-1.7 May 23, 2024 14:23
@Kartik18g Kartik18g force-pushed the bugfix/selection-issue-in-table-row branch from 5306ae8 to eb262ed Compare May 23, 2024 14:27
@Kartik18g
Copy link
Collaborator Author

Kartik18g commented May 23, 2024

Selecto hijacks the selection event of browser by overriding it, which was preventing selection within a table cell.

 dragCondition={(e) => {
        // clear browser selection on drag
        const selection = window.getSelection();
        if (selection) {
          selection.removeAllRanges();
        }
        const target = e.inputEvent.target;
        if (target.getAttribute('id') === 'real-canvas') {
          return true;
        }
        // if clicked on a component, select it and return false to prevent drag
        if (target.closest('.react-draggable')) {
          const closest = target.closest('.react-draggable');
          const id = closest.getAttribute('widgetid');
          const component = appDefinition.pages[currentPageId].components[id].component;
          const isMultiSelect = e.inputEvent.shiftKey;
          setSelectedComponent(id, component, isMultiSelect);
        }
        return false;
      }}
  

the drag condition prop allows us to control selecto's behaviour, now selecto only works if a user starts selecting from outside of a container and not within it(Which allows us to select table cell). In order to allow selection of container when it is clicked, we manually select the container by setSelectedComponent instead of letting selecto select it.

Base automatically changed from appbuilder-1.7 to main May 30, 2024 12:42
@Kartik18g Kartik18g changed the base branch from main to appbuilder-1.8 May 31, 2024 07:53
@Kartik18g
Copy link
Collaborator Author

1.8 merge #9944

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.

Unable to select text in non-editable table cell
6 participants