Skip to content
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

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

Merged
merged 12 commits into from
Oct 30, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
joshblack marked this conversation as resolved.
Show resolved Hide resolved
step: 1,
invalid: false,
invalidText: 'Provide invalidText',
invalidText: FeatureFlags.enabled('enable-v11-release')
? ''
abbeyhrt marked this conversation as resolved.
Show resolved Hide resolved
: '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,7 @@ SelectItemGroup.propTypes = {

SelectItemGroup.defaultProps = {
disabled: false,
label: 'Provide label',
label: FeatureFlags.enabled('enable-v11-release') ? '' : 'Provide label',
abbeyhrt marked this conversation as resolved.
Show resolved Hide resolved
};

export default SelectItemGroup;
11 changes: 8 additions & 3 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 @@ -44,7 +45,9 @@ export default class Tab extends React.Component {
/**
* The element ID for the top-level element.
*/
id: PropTypes.string,
id: FeatureFlags.enabled('enable-v11-release')
? PropTypes.string.isRequired
: PropTypes.string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we auto-generate the id for the component if it doesn't exist already?


/**
* The index of your Tab in your Tabs. Reserved for usage in Tabs
Expand All @@ -54,7 +57,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 @@ -98,7 +103,7 @@ export default class Tab extends React.Component {

static defaultProps = {
role: 'presentation',
label: 'provide a label',
label: FeatureFlags.enabled('enable-v11-release') ? '' : 'provide a label',
abbeyhrt marked this conversation as resolved.
Show resolved Hide resolved
selected: false,
onClick: () => {},
onKeyDown: () => {},
Expand Down