Skip to content

Commit

Permalink
fix(carbon-react): removes default props for accessible placeholders (#…
Browse files Browse the repository at this point in the history
…9741)

* fix(carbon-react): removes default props for accessible placeholders

* Update packages/react/src/components/FileUploader/FileUploader.js

Co-authored-by: Josh Black <josh@josh.black>

* Update packages/react/src/components/NumberInput/NumberInput.js

Co-authored-by: Josh Black <josh@josh.black>

* Update packages/react/src/components/Tab/Tab.js

Co-authored-by: Josh Black <josh@josh.black>

* Update packages/react/src/components/SelectItemGroup/SelectItemGroup.js

Co-authored-by: Josh Black <josh@josh.black>

* Update packages/react/src/components/NumberInput/NumberInput.js

Co-authored-by: Josh Black <josh@josh.black>

* chore(react): remove required id

Co-authored-by: Josh Black <josh@josh.black>
  • Loading branch information
abbeyhrt and joshblack authored Oct 30, 2021
1 parent adebf80 commit 51ccb35
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
9 changes: 7 additions & 2 deletions packages/react/src/components/FileUploader/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import classNames from 'classnames';
import PropTypes from 'prop-types';
import * as FeatureFlags from '@carbon/feature-flags';
import React from 'react';
import Filename from './Filename';
import FileUploaderButton from './FileUploaderButton';
Expand Down Expand Up @@ -46,7 +47,9 @@ export default class FileUploader extends React.Component {
/**
* Provide a description for the complete/close icon that can be read by screen readers
*/
iconDescription: PropTypes.string,
iconDescription: FeatureFlags.enabled('enable-v11-release')
? PropTypes.string.isRequired
: PropTypes.string,

/**
* Specify the description text of this <FileUploader>
Expand Down Expand Up @@ -97,7 +100,9 @@ export default class FileUploader extends React.Component {
static contextType = PrefixContext;

static defaultProps = {
iconDescription: 'Provide icon description',
iconDescription: FeatureFlags.enabled('enable-v11-release')
? undefined
: 'Provide icon description',
filenameStatus: 'uploading',
buttonLabel: '',
buttonKind: 'primary',
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Loading/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Loading.propTypes = {
className: PropTypes.string,

/**
* Specify an description that would be used to best describe the loading state
* Specify a description that would be used to best describe the loading state
*/
description: PropTypes.string,

Expand Down
9 changes: 7 additions & 2 deletions packages/react/src/components/NumberInput/NumberInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React, { Component } from 'react';
import classNames from 'classnames';
import { settings } from 'carbon-components';
import { Add16, Subtract16 } from '@carbon/icons-react';
import * as FeatureFlags from '@carbon/feature-flags';
import mergeRefs from '../../tools/mergeRefs';
import requiredIfValueExists from '../../prop-types/requiredIfValueExists';
// replace "use" prefix to avoid react thinking this is a hook that
Expand Down Expand Up @@ -190,10 +191,14 @@ class NumberInput extends Component {
static defaultProps = {
disabled: false,
hideLabel: false,
iconDescription: 'choose a number',
iconDescription: FeatureFlags.enabled('enable-v11-release')
? undefined
: 'choose a number',
step: 1,
invalid: false,
invalidText: 'Provide invalidText',
invalidText: FeatureFlags.enabled('enable-v11-release')
? undefined
: 'Provide invalidText',
warn: false,
warnText: '',
ariaLabel: 'Numeric input field with increment and decrement buttons',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import classnames from 'classnames';
import * as FeatureFlags from '@carbon/feature-flags';
import { settings } from 'carbon-components';

const { prefix } = settings;
Expand Down Expand Up @@ -55,7 +56,9 @@ SelectItemGroup.propTypes = {

SelectItemGroup.defaultProps = {
disabled: false,
label: 'Provide label',
label: FeatureFlags.enabled('enable-v11-release')
? undefined
: 'Provide label',
};

export default SelectItemGroup;
9 changes: 7 additions & 2 deletions packages/react/src/components/Tab/Tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
import * as FeatureFlags from '@carbon/feature-flags';
import { settings } from 'carbon-components';
import deprecate from '../../prop-types/deprecate';

Expand Down Expand Up @@ -54,7 +55,9 @@ export default class Tab extends React.Component {
/**
* Provide the contents of your Tab
*/
label: PropTypes.node,
label: FeatureFlags.enabled('enable-v11-release')
? PropTypes.node.isRequired
: PropTypes.node,

/**
* Provide a handler that is invoked when a user clicks on the control
Expand Down Expand Up @@ -97,7 +100,9 @@ export default class Tab extends React.Component {
};

static defaultProps = {
label: 'provide a label',
label: FeatureFlags.enabled('enable-v11-release')
? undefined
: 'provide a label',
selected: false,
onClick: () => {},
onKeyDown: () => {},
Expand Down

0 comments on commit 51ccb35

Please sign in to comment.