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

[BUG]: Dash-Table unexpected behavior when copying and pasting double quotes #2185

Closed
amy-morrill opened this issue Aug 8, 2022 · 5 comments
Labels
bug something broken dash-data-table related to DataTable component

Comments

@amy-morrill
Copy link
Contributor

Hi Dash team! I'm hoping to get some help with a bug I found in dash-table.

The Bug: In my application, users copy and paste data into a dash-table, and some of this data includes two consecutive double quotes. However, when copied and pasted into the table, the consecutive double quotes are automatically changed to be one double quote (e.g.: a""b becomes a"b). This is especially hard to fix because some data also contains one double quote (e.g.: a"b could be a valid input).

The Expected Behavior: Strings copied and pasted into dash-table cells should not be changed i.e. any consecutive double quotes in a string should not be converted to one double quote.

My Context:

dash                 2.0.0
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table           5.0.0
  • OS: macOS Monterey; version 12.4
  • Browser: Google Chrome; version 103.0.5060.134

Thank you for your help!! I also would be happy to try to contribute to solving this, although I'm a bit unsure of where to start.

@alexcjohnson
Copy link
Collaborator

Thanks for the report @amy-morrill - this is strange behavior indeed!

It looks like it's coming from sheetclip - specifically SheetClip.prototype.parse here:

localDf === text ? localCopy : SheetClip.prototype.parse(text);

Sheetclip is an essentially abandoned package - and in fact the exact issue you identified has been open for nearly a decade warpech/sheetclip#4. So I imagine the way to fix it will be to either find an alternative package that does the same things but without this problem, fork sheetclip and fix the problem there, or inline it into the dash-table codebase and fix the problems there. I'd probably vote for inlining it unless there's an obvious alternative package. What all the package is doing I'm not sure, but dash-table has pretty extensive tests - for example clipboard_test.ts, test_basic_copy_paste.py, and test_markdown_copy_paste.py so if they all pass that should suffice, and a new test or two in those files would cement whatever is done to fix this.

@alexcjohnson alexcjohnson added the bug something broken label Aug 9, 2022
@amy-morrill
Copy link
Contributor Author

Thank you so much for pointing me in the right direction @alexcjohnson! I'm really excited to start working on this -- I agree with you that the inline strategy makes the most sense, so I'm going to start with that.

@amy-morrill
Copy link
Contributor Author

amy-morrill commented Aug 15, 2022

@alexcjohnson not sure if this is the right place to ask this, but I'm having some trouble pushing the branch I created to the plotly/dash repository. Do I need to be added as a contributor before I can do this? If not, do you have any ideas about what might be going wrong?
Screen Shot 2022-08-15 at 10 09 59 AM
Screen Shot 2022-08-15 at 10 11 17 AM

@amy-morrill
Copy link
Contributor Author

@alexcjohnson not sure if this is the right place to ask this, but I'm having some trouble pushing the branch I created to the plotly/dash repository. Do I need to be added as a contributor before I can do this? If not, do you have any ideas about what might be going wrong? Screen Shot 2022-08-15 at 10 09 59 AM Screen Shot 2022-08-15 at 10 11 17 AM

Solved -- I didn't realize that I had to fork the dash repo before cloning. Just submitted a PR for this (#2202) :)

@T4rk1n T4rk1n added the dash-data-table related to DataTable component label Mar 10, 2023
@gvwilson
Copy link
Contributor

Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are most important to our community. If this issue is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. (Please note that we will give priority to reports that include a short reproducible example.) If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken dash-data-table related to DataTable component
Projects
None yet
Development

No branches or pull requests

4 participants