-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[data grid] A form field element should have an id or name attribute #15112
Comments
Hey @Vagizova ... I cannot reproduce the issue you are facing. The only two errors I can see are those about the resizeObserver and the strictMode (a CSB bug apparently) Locally it does not even show a single one of those Could you elaborate on the issue you are facing a bit or share screen recordings and screenshots? |
@michelengelen Hey, sure! Here it is: https://codesandbox.io/embed/kyppc4?module=/src/Demo.tsx&fontsize=12 screen-recording-2024-10-28-at-223851_avd4fAgA.mp4 |
Thanks @Vagizova ... adding a name or id should be very straightforward ... let me check real quick. |
OK< so a fix for that should be fairly easy: diff --git a/packages/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx b/packages/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx
index 5bfadd9b9..6ff8fcf96 100644
--- a/packages/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx
+++ b/packages/x-data-grid/src/components/columnSelection/GridCellCheckboxRenderer.tsx
@@ -107,6 +107,8 @@ const GridCellCheckboxForwardRef = React.forwardRef<HTMLInputElement, GridRender
? isChecked && !isIndeterminate
: isChecked;
+ const checkBoxId = `checkbox_${id}`;
+
return (
<rootProps.slots.baseCheckbox
ref={handleRef}
@@ -119,6 +121,7 @@ const GridCellCheckboxForwardRef = React.forwardRef<HTMLInputElement, GridRender
indeterminate={isIndeterminate}
disabled={!isSelectable}
touchRippleRef={rippleRef as any /* FIXME: typing error */}
+ id={checkBoxId}
{...rootProps.slotProps?.baseCheckbox}
{...other}
/>
diff --git a/packages/x-data-grid/src/components/columnSelection/GridHeaderCheckbox.tsx b/packages/x-data-grid/src/components/columnSelection/GridHeaderCheckbox.tsx
index f968f9108..e01280f54 100644
--- a/packages/x-data-grid/src/components/columnSelection/GridHeaderCheckbox.tsx
+++ b/packages/x-data-grid/src/components/columnSelection/GridHeaderCheckbox.tsx
@@ -145,6 +145,7 @@ const GridHeaderCheckbox = React.forwardRef<HTMLButtonElement, GridColumnHeaderP
tabIndex={tabIndex}
onKeyDown={handleKeyDown}
disabled={!isMultipleRowSelectionEnabled(rootProps)}
+ id={'checkbox_header'}
{...rootProps.slotProps?.baseCheckbox}
{...other}
/> I'll open this up as a good first issue. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @Vagizova How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Steps to reproduce
Link to live example: example
Steps:
Current behavior
Inputs do not have name or id attr, so i have hundreds issues in my console. It is annoying
Expected behavior
No response
Context
No response
Your environment
npx @mui/envinfo
Search keywords: row selection checkboxes
The text was updated successfully, but these errors were encountered: