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(FormControls): updated logic for rendering icons #9132
feat(FormControls): updated logic for rendering icons #9132
Conversation
Preview: https://patternfly-react-pr-9132.surge.sh A11y report: https://patternfly-react-pr-9132-a11y.surge.sh |
And this will need a code mod, right?
|
@thatblindgeye is this a regression? Is it because of the new DOM structure? Can we fix it w/o a breaking change and maybe make a follow up issue or does it require investigation today? |
@nicolethoen Yeah there'll definitely be some codemods needed after this update. I'm going to go through and open an issue(s) for anything I catch. And I believe it might be due to new structure, but I'm going to investigate a bit more into it. |
I don't know of any place that uses an icon (not a status icon) on a text area or select. @mcoker?
This is almost definitely due to the new structure - in order to make sure the icon doesn't float off by itself, the resize was moved out onto the wrapper div rather than the text area itself. Then the text area just takes up as much room as there is. Is there a way to manage auto resize with that? |
2bbcc98
to
08d1ba3
Compare
@nicolethoen @srambach Updated the autoresizing logic. Looks like the previous |
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.
@thatblindgeye this looks mostly good but I did identify some issue. Not sure if these result from this PR or other changes that were made.
- The header area in the File Upload component is weirdly truncating.
- For number input, the input fields now have spinners on them, they did not before.
- For the Time Picker, looks like the icon used inside of the field changed. PF4 was using the outlined clock which was per the original design.
@srambach @thatblindgeye I'd say let's just support whatever was supported in v4. Applying a custom icon to both select and textarea don't work as expected, so I think we can just keep that feature on textinput |
@mcarrano @srambach @thatblindgeye Looks like we're styling the old form control class for things that need to be updated with to style the right element based on the updates made in core to remove the background images. That will account for some of these visual bugs you're seeing @mcarrano. I created an issue to fix those - patternfly/patternfly#5583 |
19b6b9b
to
c651a2a
Compare
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.
the react code here looks solid
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.
c651a2a
to
d7be8b8
Compare
@@ -0,0 +1,31 @@ | |||
import * as React from 'react'; |
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.
I don't know that I would put this component in helpers. I would recommend adding it with rest of our components. Just don't export it.
export const FormControlIcon = ({ status, customIcon, className, ...props }: FormControlIconProps) => { | ||
const StatusIcon = status && statusIcons[status]; | ||
|
||
return customIcon || StatusIcon ? ( |
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.
I do not think this check is necessary this is an internal component and will always be set.
d7be8b8
to
3c3731e
Compare
@mcoker is this good to merge as is or do do we want to wait for core bug to be fixed? |
@tlabaj no need to wait for core IMO, those updates will not need a react follow up. |
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! Just one note about a modifier on <TextInput>
that I don't think is necessary.
isDisabled && styles.modifiers.disabled, | ||
isExpanded && styles.modifiers.expanded, | ||
customIcon && styles.modifiers.icon, | ||
placeholder && styles.modifiers.placeholder, |
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.
This doesn't appear to be necessary, and it looks incorrect in the core docs, too. We style the placeholder (update the color) via ::placeholder
(meaning the html element has a placeholder
attribute) - https://github.com/patternfly/patternfly/blob/474883c523da6bf7b5bbc44dc415b2d15429565c/src/patternfly/components/FormControl/form-control.scss#L150-L152
We use .pf-m-placeholder
on <FormSelect>
because a <select>
is different and doesn't support placeholder
. https://github.com/patternfly/patternfly/blob/474883c523da6bf7b5bbc44dc415b2d15429565c/src/patternfly/components/FormControl/form-control.scss#L277
3c3731e
to
bddb156
Compare
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!
Your changes have been released in:
Thanks for your contribution! 🎉 |
* feat(FormControls): updated logic for rendering icons * Updated FormSelect * Updated TextArea * Updated treeview search markup * Updated remaining integration tests * Updated autoresize logic * Updated snaphots * Updated timepicker icon * Updated FormControlIcon placement and rendering * Removed placeholder class on Textinput * Updated snapshots * Updated snapshots properly
What: Closes #9023
@srambach @mcarrano currently the Core examples for Form Control shows a Textinput with both a custom icon and a status icon. I put this functionality in React's TextInput, but notTextArea or FormSelect. Do we want to allow multiple icons to be rendered, and if so should it be on all 3 of these components?
Other notes:
pf-v5-c-form-control
class. These both (or just TreeView?) will end up needing to be updated to use SearchInput instead. For now the styling for TreeViewSearch is different as I hardcoded in markup to render the search icon on the right (rather than the left).___Icon
sub-component for TextArea,FormSelect, and TextInput. I can move this to a more applicable directory if need be.Additional issues: