Skip to content

Commit 749c81b

Browse files
committed
update isFill & inert location
1 parent 2cc5b20 commit 749c81b

2 files changed

Lines changed: 17 additions & 10 deletions

File tree

packages/react-core/src/components/SearchInput/SearchInput.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
364364
icon={<SearchIcon />}
365365
onClick={onExpandHandler}
366366
ref={searchInputExpandableToggleRef}
367-
{...(isExpanded && { inert: '' })}
368367
/>
369368
);
370369

@@ -375,7 +374,6 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
375374
aria-expanded={isExpanded}
376375
icon={<TimesIcon />}
377376
onClick={onExpandHandler}
378-
{...(!isExpanded && { inert: '' })}
379377
/>
380378
);
381379

@@ -400,10 +398,19 @@ const SearchInputBase: React.FunctionComponent<SearchInputProps> = ({
400398
{!hasAnimations && <InputGroupItem isPlain>{singleButtonToggle}</InputGroupItem>}
401399
{hasAnimations && (
402400
<>
403-
<InputGroupItem className={inputGroupStyles.modifiers.searchExpand} isPlain onTransitionEnd={onTransitionEnd}>
401+
<InputGroupItem
402+
className={inputGroupStyles.modifiers.searchExpand}
403+
isPlain
404+
onTransitionEnd={onTransitionEnd}
405+
{...(isExpanded && { inert: '' })}
406+
>
404407
{expandToggleButton}
405408
</InputGroupItem>
406-
<InputGroupItem className={inputGroupStyles.modifiers.searchAction} isPlain>
409+
<InputGroupItem
410+
className={inputGroupStyles.modifiers.searchAction}
411+
isPlain
412+
{...(!isExpanded && { inert: '' })}
413+
>
407414
{collapseToggleButton}
408415
</InputGroupItem>
409416
</>

packages/react-core/src/components/SearchInput/__tests__/SearchInput.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ test('animate classes & inert are not rendered when hasAnimations is false', ()
252252
expect(screen.getByTestId('test-id')).not.toHaveClass(`${inputGroupStyles.modifiers.expanded}`);
253253

254254
expect(screen.getByTestId('test-id').children[0]).not.toHaveClass(`${inputGroupStyles.modifiers.searchInput}`);
255-
expect(screen.getByTestId('test-id').children[0]).not.toHaveAttribute('inert', '');
255+
expect(screen.getByTestId('test-id').children[0].parentElement).not.toHaveAttribute('inert', '');
256256

257257
expect(screen.getAllByRole('button')).toHaveLength(1);
258258
expect(screen.getAllByRole('button')[0].parentElement).not.toHaveClass(`${inputGroupStyles.modifiers.searchExpand}`);
259259
expect(screen.getAllByRole('button')[0].parentElement).not.toHaveClass(`${inputGroupStyles.modifiers.searchAction}`);
260-
expect(screen.getAllByRole('button')[0]).not.toHaveAttribute('inert', '');
260+
expect(screen.getAllByRole('button')[0].parentElement).not.toHaveAttribute('inert', '');
261261
});
262262

263263
test('animate classes & inert are properly rendered when hasAnimations is true and isExpanded is false', () => {
@@ -283,10 +283,10 @@ test('animate classes & inert are properly rendered when hasAnimations is true a
283283
);
284284
expect(screen.getAllByRole('button')).toHaveLength(2);
285285
expect(screen.getAllByRole('button')[0].parentElement).toHaveClass(`${inputGroupStyles.modifiers.searchExpand}`);
286-
expect(screen.getAllByRole('button')[0]).not.toHaveAttribute('inert', '');
286+
expect(screen.getAllByRole('button')[0].parentElement).not.toHaveAttribute('inert', '');
287287

288288
expect(screen.getAllByRole('button')[1].parentElement).toHaveClass(`${inputGroupStyles.modifiers.searchAction}`);
289-
expect(screen.getAllByRole('button')[1]).toHaveAttribute('inert', '');
289+
expect(screen.getAllByRole('button')[1].parentElement).toHaveAttribute('inert', '');
290290
});
291291

292292
test('animate classes and inert are properly rendered when hasAnimations and isExpanded are true', () => {
@@ -312,10 +312,10 @@ test('animate classes and inert are properly rendered when hasAnimations and isE
312312
);
313313
expect(screen.getAllByRole('button')).toHaveLength(2);
314314
expect(screen.getAllByRole('button')[0].parentElement).toHaveClass(`${inputGroupStyles.modifiers.searchExpand}`);
315-
expect(screen.getAllByRole('button')[0]).toHaveAttribute('inert', '');
315+
expect(screen.getAllByRole('button')[0].parentElement).toHaveAttribute('inert', '');
316316

317317
expect(screen.getAllByRole('button')[1].parentElement).toHaveClass(`${inputGroupStyles.modifiers.searchAction}`);
318-
expect(screen.getAllByRole('button')[1]).not.toHaveAttribute('inert', '');
318+
expect(screen.getAllByRole('button')[1].parentElement).not.toHaveAttribute('inert', '');
319319
});
320320

321321
test('onToggleExpand is not called if the expandable toggle is not clicked', () => {

0 commit comments

Comments
 (0)