Skip to content

when cell_selectable=False table text cannot be copied to the clipboard in data table #1978

Open
@ned2

Description

Describe the bug

When a DataTable is initialised with cell_selectable=False, text cannot be copied to the clipboard. This is independent of the issue in #1975 where cells in columns with presentation value of input do not appear to be visually selected. The text can actually be selected, however when attempting to copy the selection, nothing is added to the clipboard.

Expected behavior
When cell_selectable is false, text selected inside DataTable cells should be able to be copied to the clipboard as is normally handled by the browser.

Minimal Example
Text in any cell (regardless of presentation) cannot be copied to the clipboard.

import dash
import pandas as pd
from dash import html
from dash.dash_table import DataTable

url = "https://github.com/plotly/datasets/raw/master/26k-consumer-complaints.csv"
df = pd.read_csv(url, nrows=100)
columns = [{"name": col, "id": col, "selectable": True} for col in df.columns]
columns[2]["presentation"] = "markdown"

app = dash.Dash(__name__)
app.layout = html.Div(
    [
        DataTable(
            columns=columns,
            data=df.to_dict("records"),
            cell_selectable=False,
        )
    ]
)

if __name__ == "__main__":
    app.run_server(debug=True, port=8050)

Environment

dash                          2.3.0
dash-bootstrap-components     1.0.3
dash-core-components          2.0.0
dash-html-components          2.0.0
dash-table                    5.0.0

- OS: Ubuntu 21.10
- Browser Chrome
- Version 99.0.4844.51

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething brokendash-data-tablerelated to DataTable component

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions