{
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
sx?: SxProps {
*/
sx?: SxProps {
* @default 'medium'
*/
size?: OverridableStringUnion<'small' | 'medium', ChipPropsSizeOverrides>;
+ /**
+ * If `true`, allows the disabled chip to escape focus.
+ * If `false`, allows the disabled chip to receive focus.
+ * @default false
+ */
+ skipFocusWhenDisabled?: boolean;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
diff --git a/packages/mui-material/src/Chip/Chip.js b/packages/mui-material/src/Chip/Chip.js
index 2baad5586017dd..6774de28d4dabe 100644
--- a/packages/mui-material/src/Chip/Chip.js
+++ b/packages/mui-material/src/Chip/Chip.js
@@ -347,6 +347,7 @@ const Chip = React.forwardRef(function Chip(inProps, ref) {
size = 'medium',
variant = 'filled',
tabIndex,
+ skipFocusWhenDisabled,
...other
} = props;
@@ -461,7 +462,7 @@ const Chip = React.forwardRef(function Chip(inProps, ref) {
onKeyDown={handleKeyDown}
onKeyUp={handleKeyUp}
ref={handleRef}
- tabIndex={disabled ? -1 : tabIndex}
+ tabIndex={skipFocusWhenDisabled && disabled ? -1 : tabIndex}
ownerState={ownerState}
{...moreProps}
{...other}
@@ -563,6 +564,12 @@ Chip.propTypes /* remove-proptypes */ = {
PropTypes.oneOf(['medium', 'small']),
PropTypes.string,
]),
+ /**
+ * If `true`, allows the disabled chip to escape focus.
+ * If `false`, allows the disabled chip to receive focus
+ * @default false
+ */
+ skipFocusWhenDisabled: PropTypes.bool,
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
*/
diff --git a/packages/mui-material/src/Chip/Chip.test.js b/packages/mui-material/src/Chip/Chip.test.js
index 99971ab92170a6..ee20d7fc50429f 100644
--- a/packages/mui-material/src/Chip/Chip.test.js
+++ b/packages/mui-material/src/Chip/Chip.test.js
@@ -174,9 +174,16 @@ describe(' {
* If `true`, allows the disabled chip to escape focus.
* If `false`, allows the disabled chip to receive focus.
* @default false
- */
+ */
skipFocusWhenDisabled?: boolean;
/**
* The system prop that allows defining system overrides as well as additional CSS styles.
From cbaaed6b8fb59b1c1610df302d7d82afb1aa8c8c Mon Sep 17 00:00:00 2001
From: sai6855 <60743144+sai6855@users.noreply.github.com>
Date: Wed, 23 Nov 2022 15:36:13 +0530
Subject: [PATCH 11/12] made default value false
---
packages/mui-material/src/Chip/Chip.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/mui-material/src/Chip/Chip.js b/packages/mui-material/src/Chip/Chip.js
index 78966cc3782130..1d0075201ef4e2 100644
--- a/packages/mui-material/src/Chip/Chip.js
+++ b/packages/mui-material/src/Chip/Chip.js
@@ -347,7 +347,7 @@ const Chip = React.forwardRef(function Chip(inProps, ref) {
size = 'medium',
variant = 'filled',
tabIndex,
- skipFocusWhenDisabled,
+ skipFocusWhenDisabled = false,
...other
} = props;
From bface646c050d70140f771ef98630f5372450d84 Mon Sep 17 00:00:00 2001
From: sai6855 <60743144+sai6855@users.noreply.github.com>
Date: Thu, 24 Nov 2022 19:37:56 +0530
Subject: [PATCH 12/12] updated test name and todo comment
---
packages/mui-material/src/Chip/Chip.js | 2 +-
packages/mui-material/src/Chip/Chip.test.js | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/packages/mui-material/src/Chip/Chip.js b/packages/mui-material/src/Chip/Chip.js
index 1d0075201ef4e2..87925389a8fc51 100644
--- a/packages/mui-material/src/Chip/Chip.js
+++ b/packages/mui-material/src/Chip/Chip.js
@@ -347,7 +347,7 @@ const Chip = React.forwardRef(function Chip(inProps, ref) {
size = 'medium',
variant = 'filled',
tabIndex,
- skipFocusWhenDisabled = false,
+ skipFocusWhenDisabled = false, // TODO v6: Rename to `focusableWhenDisabled`.
...other
} = props;
diff --git a/packages/mui-material/src/Chip/Chip.test.js b/packages/mui-material/src/Chip/Chip.test.js
index ee20d7fc50429f..1cf81c596aa535 100644
--- a/packages/mui-material/src/Chip/Chip.test.js
+++ b/packages/mui-material/src/Chip/Chip.test.js
@@ -174,8 +174,7 @@ describe('
| object
| bool>
| func
| object"
}
},
+ "tabIndex": { "type": { "name": "number" } },
"variant": {
"type": {
"name": "union",
diff --git a/docs/translations/api-docs/chip/chip.json b/docs/translations/api-docs/chip/chip.json
index 5012cbf664f9d0..e69e189d53994d 100644
--- a/docs/translations/api-docs/chip/chip.json
+++ b/docs/translations/api-docs/chip/chip.json
@@ -14,6 +14,7 @@
"onDelete": "Callback fired when the delete icon is clicked. If set, the delete icon will be shown.",
"size": "The size of the component.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details.",
+ "tabIndex": "tab order of an element",
"variant": "The variant to use."
},
"classDescriptions": {
From 8e8dc3598c45066928b0929e55047f125e17e670 Mon Sep 17 00:00:00 2001
From: sai6855 <60743144+sai6855@users.noreply.github.com>
Date: Wed, 9 Nov 2022 21:17:09 +0530
Subject: [PATCH 05/12] [Chip] updated tabIndex prop description
---
docs/pages/material-ui/api/chip.json | 1 -
docs/translations/api-docs/chip/chip.json | 1 -
packages/mui-material/src/Chip/Chip.d.ts | 2 +-
packages/mui-material/src/Chip/Chip.js | 2 +-
4 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/docs/pages/material-ui/api/chip.json b/docs/pages/material-ui/api/chip.json
index 863e18466df66d..c0aa34f7971e66 100644
--- a/docs/pages/material-ui/api/chip.json
+++ b/docs/pages/material-ui/api/chip.json
@@ -30,7 +30,6 @@
"description": "Array<func
| object
| bool>
| func
| object"
}
},
- "tabIndex": { "type": { "name": "number" } },
"variant": {
"type": {
"name": "union",
diff --git a/docs/translations/api-docs/chip/chip.json b/docs/translations/api-docs/chip/chip.json
index e69e189d53994d..5012cbf664f9d0 100644
--- a/docs/translations/api-docs/chip/chip.json
+++ b/docs/translations/api-docs/chip/chip.json
@@ -14,7 +14,6 @@
"onDelete": "Callback fired when the delete icon is clicked. If set, the delete icon will be shown.",
"size": "The size of the component.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details.",
- "tabIndex": "tab order of an element",
"variant": "The variant to use."
},
"classDescriptions": {
diff --git a/packages/mui-material/src/Chip/Chip.d.ts b/packages/mui-material/src/Chip/Chip.d.ts
index 176869163728fe..e8739089c9f124 100644
--- a/packages/mui-material/src/Chip/Chip.d.ts
+++ b/packages/mui-material/src/Chip/Chip.d.ts
@@ -77,7 +77,7 @@ export interface ChipTypeMaptrue
, allows the disabled chip to escape focus. If false
, allows the disabled chip to receive focus.",
"sx": "The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details.",
"variant": "The variant to use."
},
diff --git a/packages/mui-material/src/Chip/Chip.js b/packages/mui-material/src/Chip/Chip.js
index 6774de28d4dabe..78966cc3782130 100644
--- a/packages/mui-material/src/Chip/Chip.js
+++ b/packages/mui-material/src/Chip/Chip.js
@@ -566,7 +566,7 @@ Chip.propTypes /* remove-proptypes */ = {
]),
/**
* If `true`, allows the disabled chip to escape focus.
- * If `false`, allows the disabled chip to receive focus
+ * If `false`, allows the disabled chip to receive focus.
* @default false
*/
skipFocusWhenDisabled: PropTypes.bool,
From dc6868469ba41f7129b2ff95a2489fbde8da60c8 Mon Sep 17 00:00:00 2001
From: sai6855 <60743144+sai6855@users.noreply.github.com>
Date: Wed, 23 Nov 2022 15:19:56 +0530
Subject: [PATCH 10/12] prettier changes
---
packages/mui-material/src/Chip/Chip.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/mui-material/src/Chip/Chip.d.ts b/packages/mui-material/src/Chip/Chip.d.ts
index 9e8c0768feebb8..4e8644064f1a2c 100644
--- a/packages/mui-material/src/Chip/Chip.d.ts
+++ b/packages/mui-material/src/Chip/Chip.d.ts
@@ -76,7 +76,7 @@ export interface ChipTypeMap