Skip to content

Conversation

kmcfaul
Copy link
Contributor

@kmcfaul kmcfaul commented Jun 17, 2025

What: Closes #11855

Adds hasAnimations to expandableInput (the props object that enables expand/collapse) and tied the new animations + structure to the flag. Also tweaks the extra buttons that can occur within a search input + advanced search input to account for expandable, since it is possible to currently pass the expandableInput to other variants of SearchInput.

@patternfly-build
Copy link
Contributor

patternfly-build commented Jun 17, 2025

@kmcfaul kmcfaul force-pushed the search-input-animations branch from f50ebe4 to dc0c86d Compare June 17, 2025 15:44
@srambach
Copy link
Member

Looks fabulous! Only one comment - if I use the keyboard to close it, I don't see the focus ring on the search icon button once it's closed. In the existing version, that button got focus and you could just hit enter to re-expand the search input.

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Other than the above regarding focus indicator + below nit, we should also add tests to ensure the new classes, attribute(s) (inert really), and markup is correct both by default and when opting into animations. I'd be fine with that as a followup if we prioritize it as part of code freeze just so we don't lose track of it

onToggleExpand: (event: React.SyntheticEvent<HTMLButtonElement>, isExpanded: boolean) => void;
/** An accessible label for the expandable search input toggle. */
toggleAriaLabel: string;
/** Flag indicating animations should be enabled when the search input expands and collapses. */
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker, but may be worth noting this will alter the markup or something, and if we intend to remove this and have it be default behavior in the next breaking change then noting this will be removed in the next breaking change as well

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 17, 2025

Added a handful of tests for the new classes/inert.

Re: the keyboard focus issue, this seems to be caused by the transition animation that plays on close. I've added a tiny timeout to the focus event and it seems to resolve it, but if you slow the animation down it happens still.

I'm not sure if there's a better way to calc a timeout or wait for the animation. cc @thatblindgeye

@kmcfaul kmcfaul force-pushed the search-input-animations branch from ad399dd to a31c987 Compare June 17, 2025 19:56
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

LGTM! Just need to remove isFill from the item that wraps the text input. Left another comment but it's more of a note, you may prefer the way it is now over my comment.

icon={<SearchIcon />}
onClick={onExpandHandler}
ref={searchInputExpandableToggleRef}
{...(isExpanded && { inert: '' })}
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a comment, but if it's preferred, you could put inert on the <InputGroupItem /> and it will render everything in it as inert. There is only one one thing in it now, so there's no benefit to changing it, but I would probably put inert on the <InputGroupItem /> to indicate that the whole element should be ignored. Similar to if we conditionally rendered the expand toggle, I'd conditionally render the <InputGroupItem />, not just the button in it.

<InputGroupItem isFill>{buildTextInputGroup()} </InputGroupItem>
<InputGroupItem isPlain>{expandableToggle}</InputGroupItem>
<InputGroupItem
isFill
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove isFill from anywhere inputGroupStyles.modifiers.searchInput is defined? It's used to set flex-grow, and since we may need to change the flex-grow behavior down the road, I've moved it to the CSS instead of being tied to the markup to avoid a breaking change later.

<InputGroup ref={triggerRef} {...searchInputProps}>
<InputGroupItem isFill>{buildTextInputGroup()}</InputGroupItem>
<InputGroupItem
isFill
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove this instance, too

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

Reapproving latest updates. The focus back to the expand button looks to work at 100, 25, and 10% animation speeds in dev tools

Copy link
Member

@srambach srambach left a comment

Choose a reason for hiding this comment

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

I agree, keyboard control looks good now. 👍🏻

@mcoker
Copy link
Contributor

mcoker commented Jun 18, 2025

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Jun 18, 2025

Odd, I definitely updated that locally along with the inert changes but it didn't go in? Will reupdate.

Edit: apparently I forgot to hit save before that commit 😆

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

L🐸TM!

@mcoker mcoker merged commit 50ddd0f into patternfly:main Jun 18, 2025
13 checks passed
@patternfly-build
Copy link
Contributor

Your changes have been released in:

Thanks for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SearchInput - enable animation of expandable search input

5 participants