primereact icon indicating copy to clipboard operation
primereact copied to clipboard

validator.w3.org shows Error "Attribute pr_id_18 not allowed on element [div]" for DataTable with Multiple Columns

Open AlexITZB opened this issue 1 year ago • 1 comments

Describe the bug

For DataTbale "Multiple columns" validator.w3.org shows the following error:

Attribute pr_id_18 not allowed on element div at this point.

Reproducer

No response

PrimeReact version

10.6.2

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Copy the "Multiple Columns" card element of https://primereact.org/datatable/
  2. Paste it into https://validator.w3.org/nu/#textarea

Expected behavior

No errors in the validator output.

AlexITZB avatar Apr 04 '24 12:04 AlexITZB

Well its an extra attribute causing no harm right? Its a unque identifier added to the table.

 useMountEffect(() => {
        if (elementRef.current) {
            attributeSelector.current = UniqueComponentId();
            elementRef.current.setAttribute(attributeSelector.current, '');
        }

That way later with CSS selectors that can select this table if many tables like..

 let selector = `[data-pc-name="datatable"][${attributeSelector.current}] > [data-pc-section="wrapper"]

melloware avatar Apr 04 '24 12:04 melloware