-
Notifications
You must be signed in to change notification settings - Fork 104
feat(search-input): animate expandable search input #7451
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
feat(search-input): animate expandable search input #7451
Conversation
|
Preview: https://patternfly-pr-7451.surge.sh A11y report: https://patternfly-pr-7451-a11y.surge.sh |
63bdb13 to
294fbbb
Compare
|
@mcoker Please take another look |
294fbbb to
091e1d8
Compare
search-input-expandable.mov |
091e1d8 to
52b11ed
Compare
srambach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably document the new classes.
Also, can we use $pf-prefix on the .pf-v6-c- classes here or no?
Otherwise, looks this looks good.
|
I pushed updates to use |
a986519 to
2932db9
Compare
srambach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the generic mixin is merged, it would be great to use it here too but otherwise,
L🔍TM!
|
I noticed the search icon shifts a bit in Chrome. It seems fine in both safari and Firefox. Not a big deal but wanted to let you know Screen.Recording.2025-05-27.at.5.06.49.PM.mov |
mcoker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM though left some comments
| width: 100%; | ||
| } | ||
|
|
||
| .#{$input-group}-expandable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this isn't .pf-m-expandable? You could also call it .pf-m-search-input, which might be more appropriate since IMO this needs some kind of modifier like that as it's a unique react component. That also gives us the room to use .pf-m-expandable later for a generally expandable input group.
| } | ||
| } | ||
|
|
||
| .#{$pf-prefix}c-search-input { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this isn't a component, it should probably be .pf-v6-c-input-group__item.pf-m-search-input but if you used .pf-m-search-input on the outer wrapper, it would probably be better to use something different here. Maybe .pf-v6-c-input-group__item.pf-m-search-text-input? We have a #{$text-input-group}__text-input so I I think .pf-m-search-text-input would be fine.
| opacity: 0; | ||
| transition-timing-function: var(--#{$input-group}-expandable__search-input--TransitionTimingFunction--collapse); | ||
| transition-duration: var(--#{$input-group}-expandable__search-input--TransitionDuration--collapse); | ||
| transition-property: opacity, scale, display; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of transitioning display, can you transition visibility and width to hide it? Then it will work x-browser without needing allow-discrete and @starting-style
| animation-name: #{$input-group}-expandable-fade; | ||
| animation-duration: var(--#{$input-group}-expandable__button-icon--TransitionDuration--Opacity); | ||
| animation-timing-function: var(--#{$input-group}-expandable__button-icon--TransitionTimingFunction--Opacity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way this can be a transition so it doesn't run on page load?
6c9b2d0 to
6d1d465
Compare
3b5adf2 to
3bd693b
Compare
|
@mcoker @thatblindgeye Here's a slowed down example to show what is happening. Note that the click animation isn't triggered when using keyboard navigation. Screen.Recording.2025-06-10.at.10.03.06.AM.mov |
3bd693b to
7f895a1
Compare
|
To test this, just toggle the I added the docs for the new classes and hwhat-not under the input group - https://patternfly-pr-7451.surge.sh/components/input-group#usage. I'm not sure if that's the right place for them... Technically the classes apply to input group elements, but the example is listed under text input group (in core anyways, it's its own component in react). So I listed the docs under input group for now with a note that the examples are under text input group and the search input component pages. Let me know if anyone feels strongly about changing that and I'll update it. |
src/patternfly/components/TextInputGroup/examples/TextInputGroup.md
Outdated
Show resolved
Hide resolved
…up.md Co-authored-by: Sarah Rambacher <srambach@redhat.com>
Co-authored-by: Sarah Rambacher <srambach@redhat.com>
srambach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
srambach
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 GTM!
|
🎉 This PR is included in version 6.3.0-prerelease.32 🎉 The release is available on: Your semantic-release bot 📦🚀 |

Feature #6603
This expand behavior is based off @mcokers POC codepen using
scaletransition for the search input that. It's set todisplay: nonein the collapsed state.To see the animation, use the chrome dev tools to toggle the

pf-m-expandedmodifier class. (Note: at closed state the X button will display because it requires the react component to switch the displayed icon to the magnifying glass.These changes key off a
pf-v6-c-input-group__search-expandableclass along with modifierpf-m-expandedadded to the<SearchInput...component.The expanded text input uses an abbreviated
scale(.7) value to transition from partial to full widthscale(1)and by default thetransition-origindirection is from left to right. Adding apf-m-expand-leftmodifier will set thetransition-originto transition from right to left.These changes necessitate a few changes to the React component.
In the “collapsed” state, an
<InputGroupItem className="pf-v6-c-search-input">{buildTextInputGroup()}</InputGroupItem>is included with toggle button https://github.com/patternfly/patternfly-react/blob/main/packages/react-core/src/components/SearchInput/SearchInput.tsx#L415-L417 Without thepf-m-expandedandpf-m-fillclasses and will be set to display:noneAdditional changes: The close button icon opacity fade-in specified in
@keyframesanimation-name: #{$input-group}-expandable-fade-incould be replaced by a generic fade mixin that is proposed for inclusion with this PR.