Skip to content

Commit

Permalink
Fixed #2717 - Add inputId property to Chips
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 4, 2022
1 parent a28f04a commit 8049ef2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions components/doc/chips/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ customChip(item) {
<td>null</td>
<td>Unique identifier of the component.</td>
</tr>
<tr>
<td>inputId</td>
<td>string</td>
<td>null</td>
<td>Identifier of the focus input to match a label defined for the chips.</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
Expand Down
1 change: 1 addition & 0 deletions components/lib/chips/Chips.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ interface ChipsChangeParams {
export interface ChipsProps {
id?: string;
inputRef?: React.Ref<HTMLInputElement>;
inputId?: string;
name?: string;
placeholder?: string;
value?: any[];
Expand Down
3 changes: 2 additions & 1 deletion components/lib/chips/Chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const Chips = React.memo(React.forwardRef((props, ref) => {
const createInput = () => {
return (
<li className="p-chips-input-token">
<input ref={inputRef} placeholder={props.placeholder} type="text" name={props.name} disabled={props.disabled || isMaxedOut()}
<input ref={inputRef} id={props.inputId} placeholder={props.placeholder} type="text" name={props.name} disabled={props.disabled || isMaxedOut()}
onKeyDown={onKeyDown} onPaste={onPaste} onFocus={onFocus} onBlur={onBlur} aria-labelledby={props.ariaLabelledBy}
readOnly={props.readOnly} />
</li>
Expand Down Expand Up @@ -229,6 +229,7 @@ Chips.defaultProps = {
__TYPE: 'Chips',
id: null,
inputRef: null,
inputId: null,
name: null,
placeholder: null,
value: null,
Expand Down

0 comments on commit 8049ef2

Please sign in to comment.