diff --git a/cypress/component/Autocomplete.spec.tsx b/cypress/component/Autocomplete.spec.tsx index ba912a5ddd..2a98b0bfa7 100644 --- a/cypress/component/Autocomplete.spec.tsx +++ b/cypress/component/Autocomplete.spec.tsx @@ -127,7 +127,9 @@ describe('Autocomplete', () => { context('when the clear button is clicked', () => { beforeEach(() => { - cy.get('[data-testid=clear]').click(); + // Force click because Cypress gets confused if an element had `pointer-events; none` at any point + // in time, even if it doesn't at the point the click was attempted. + cy.get('[data-testid=clear]').click({force: true}); }); it('should clear the combobox', () => { diff --git a/modules/react/text-input/lib/InputGroup.tsx b/modules/react/text-input/lib/InputGroup.tsx index 3400d0bb1c..d2b19a7743 100644 --- a/modules/react/text-input/lib/InputGroup.tsx +++ b/modules/react/text-input/lib/InputGroup.tsx @@ -112,6 +112,7 @@ export const useInputGroupInput = createElemPropsHook(useInputGroupModel)((model return { ref: elementRef, + placeholder: '', // Make sure a placeholder attribute always exists for `:placeholder-shown` }; }); @@ -172,7 +173,6 @@ export const useClearButton = createElemPropsHook(useInputGroupModel)(model => { // This will clear the input's value dispatchInputEvent(model.state.inputRef.current, ''); }, - placeholder: '', // Make sure a placeholder attribute always exists for `:placeholder-shown` } as const; }); @@ -211,8 +211,6 @@ export const inputGroupStencil = createStencil({ // Clear Button '& :has([data-part="input-group-clear-button"])': { transition: 'opacity 300ms ease', - opacity: 1, - pointerEvents: 'auto', }, // Clear Button when a placeholder is being shown (no value) @@ -311,7 +309,7 @@ export const InputGroup = createContainer('div')({ }); } if (child.type === InputGroupInnerEnd) { - const offset = wrapInCalc(offsetsEnd.slice(indexEnd, -1)) || '0px'; + const offset = wrapInCalc(offsetsEnd.slice(indexEnd + 1, offsetsEnd.length)) || '0px'; indexEnd++; return React.cloneElement(child, { diff --git a/modules/react/text-input/stories/TextInput.mdx b/modules/react/text-input/stories/TextInput.mdx index 5a6b1e89b4..698b495eb3 100644 --- a/modules/react/text-input/stories/TextInput.mdx +++ b/modules/react/text-input/stories/TextInput.mdx @@ -95,7 +95,8 @@ and will be semantically correct in left-to-right and right-to-left languages. `InputGroup.InnerStart` and `InputGroup.InnerEnd` subcomponents can handle any child elements, but are built for icons. The default width is `40px`, which is perfect for icons. If you need to use something else, be sure to set the `width` property of `InputGroup.InnerStart` or -`InputGroup.InnerEnd` to match the intended width of the element. +`InputGroup.InnerEnd` to match the intended width of the element. Do not use the `cs` prop or any +method to change width. The `width` prop is used to correctly position other inner elements. diff --git a/modules/react/text-input/stories/visualTesting.stories.tsx b/modules/react/text-input/stories/visualTesting.stories.tsx index 2d6b38d854..8049ba5da7 100644 --- a/modules/react/text-input/stories/visualTesting.stories.tsx +++ b/modules/react/text-input/stories/visualTesting.stories.tsx @@ -90,29 +90,66 @@ export const InputGroupStates = () => ( ]}}, + { + label: 'Start', + props: { + start: [ + + + , + ], + }, + }, { label: 'End', props: { end: [ - , + + + , ], }, }, { label: 'Both', props: { - start: [], + start: [ + + + , + ], end: [ - , + + + , ], }, }, { label: 'Multiple', props: { - start: [1, 2, 3], - end: [4, 5, 6], + start: [ + + 1 + , + + 2 + , + + 3 + , + ], + end: [ + + 4 + , + + 5 + , + + 6 + , + ], }, }, { @@ -121,7 +158,11 @@ export const InputGroupStates = () => ( placeholder: 'Placeholder', value: 'Some Value', start: [], - end: [], + end: [ + + + , + ], }, }, { @@ -130,7 +171,27 @@ export const InputGroupStates = () => ( placeholder: '', value: '', start: [], - end: [], + end: [ + + + , + ], + }, + }, + { + label: 'Variable Width', + props: { + end: [ + + 1 + , + + 2 + , + + 3 + , + ], }, }, ]} @@ -142,20 +203,12 @@ export const InputGroupStates = () => ( {({value, placeholder, ...props}) => ( - {props.start && - props.start.map((start, index) => ( - - {start} - - ))} + {props.start} - {props.end && - props.end.map((end, index) => ( - {end} - ))} + {props.end} )}