8000 fix(form-control): addition of vars for MUI theming by sg00dwin · Pull Request #7291 · patternfly/patternfly · GitHub
[go: up one dir, main page]

Skip to content

fix(form-control): addition of vars for MUI theming#7291

Merged
mcoker merged 4 commits intopatternfly:mainfrom
sg00dwin:7222-form-control
Mar 18, 2025
Merged

fix(form-control): addition of vars for MUI theming#7291
mcoker merged 4 commits intopatternfly:mainfrom
sg00dwin:7222-form-control

Conversation

@sg00dwin
Copy link
Contributor
@sg00dwin sg00dwin commented Jan 9, 2025

fixes #7222

New available variables

 --#{$form-control}__input--PaddingBlockStart
 --#{$form-control}__input--PaddingBlockEnd
 --#{$form-control}__input--PaddingInlineStart
 --#{$form-control}__input--PaddingInlineEnd
  
 --#{$form-control}__select--PaddingBlockStart
 --#{$form-control}__select--PaddingBlockEnd
 --#{$form-control}__select--PaddingInlineStart
 --#{$form-control}__select--PaddingInlineEnd

 --#{$form-control}__textarea--PaddingBlockStart
 --#{$form-control}__textarea--PaddingBlockEnd
 --#{$form-control}__textarea--PaddingInlineStart
 --#{$form-control}__textarea--PaddingInlineEnd

Realated
Textarea text realigned with status icon
Select status icon spacing with down caret corrected

BackstopJS Report.pdf

@patternfly-build
Copy link
Collaborator
patternfly-build commented Jan 9, 2025

@mcoker mcoker requested review from mcoker and srambach January 14, 2025 16:32
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.

Left a few comments to review.

This is what it looks like currently if I customize the padding vars - note that the right padding doesn't apply to the right of the utilities element (select toggle, status icons, manually passed icons) and instead applies to the inner form element (the actual input, select, textarea)

Screenshot 2025-01-14 at 3 47 33 PM Screenshot 2025-01-14 at 3 47 42 PM

This means you would set __[element]--PaddingInlineEnd to theme the space between the input and utilities/icons, and set __utilities--PaddingInlineEnd to theme the right padding of the component, though you would have to set __utilities--PaddingInlineEnd globally, since there isn't a var per form control type.

I would probably expect these vars to change the right padding of the utilities element, too - meaning they change the padding inside of the border for the component. Like this:

Screenshot 2025-01-14 at 3 46 20 PM Screenshot 2025-01-14 at 3 46 26 PM

Then if you wanted to set the gap between the form element and the utilities/icons, you'd have to set --pf-v6-c-form-control--ColumnGap, though same issue as above where we don't have a var per form control type so it's a global change.

Though that requirement wasn't clear in the original request, so I'm curious what others think. wdyt @sg00dwin @srambach @jenny-s51?


> select {
--#{$form-control}--PaddingInlineEnd: var(--#{$form-control}__select--PaddingInlineEnd);
@at-root .#{$form-control}:has(select) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be rewritten as the suggestion below to be more consistent with how the other selectors are written?

Suggested change
@at-root .#{$form-control}:has(select) {
&:has(select) {

Comment on lines +305 to +338
> :is(input, textarea) {
padding-inline-end: var(--#{$form-control}--m-success--PaddingInlineEnd);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can't use --#{$form-control}--PaddingInlineEnd: var(--#{$form-control}--m-success--PaddingInlineEnd); here because --#{$form-control}--m-success--PaddingInlineEnd references --#{$form-control}--PaddingInlineEnd. You can probably fix that if you update it to reference --#{$form-control}--PaddingInlineEnd--base instead in this var

--#{$form-control}--m-success--PaddingInlineEnd: calc(var(--#{$form-control}__icon--FontSize) + var(--#{$form-control}--PaddingInlineEnd) + var(--#{$form-control}--ColumnGap));

Same goes for other properties you may have set the actual property for instead of the CSS var.

// select padding
--#{$form-control}__select--PaddingBlockStart: var(--#{$form-control}--PaddingBlockStart--base);
--#{$form-control}__select--PaddingBlockEnd: var(--#{$form-control}--PaddingBlockEnd--base);
--#{$form-control}__select--PaddingInlineEnd: var(--#{$form-control}--PaddingInlineEnd--base);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a pre-existing bug, but I wonder if we should try and fix it in this PR. The select's right padding doesn't take into account the icon width, so long items in the select will display under the icon

Screenshot 2025-01-14 at 11 54 59 AM

Off the top of my head, I might try these changes (all pseudo code, probably doesn't work, full of typos, etc)

// add font-size var for toggle-icon
--#{$form-control}__toggle-icon--FontSize: var(--pf-t--global--icon--size--body--default);

// change this existing declaration to account for toggle icon
--#{$form-control}__select--PaddingInlineEnd: calc(var(--#{$form-control}--PaddingInlineEnd--base) + var(--#{$form-control}__toggle-icon--FontSize));

// add font-size declaration to toggle-icon
.#{$form-control}__toggle-icon {
  font-size: var(--#{$form-control}__toggle-icon--FontSize);
}

@sg00dwin sg00dwin force-pushed the 7222-form-control branch 2 times, most recently from a8861f0 to ebc2da5 Compare February 3, 2025 23:54
@sg00dwin
Copy link
Contributor Author
sg00dwin commented Feb 3, 2025

@mcoker I have reworked the changes and I believe they address all the issues you noted.

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.

Looks good with long text, focus ring, rtl 👍🏻

@andrew-ronaldson andrew-ronaldson linked an issue Mar 5, 2025 that may be closed by this pull request
3 tasks
@mcoker mcoker force-pushed the 7222-form-control branch from ebc2da5 to c0767b5 Compare March 18, 2025 05:23
@mcoker mcoker requested review from mcoker and srambach March 18, 2025 05:24
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.

🆒 🫘's

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.

8000

@sg00dwin
Copy link
Contributor Author

@mcoker tested your latest changes and all looks good!

@mcoker mcoker merged commit 7162bd4 into patternfly:main Mar 18, 2025
4 checks passed
@patternfly-build
Copy link
Collaborator

🎉 This PR is included in version 6.2.0-prerelease.25 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Projects

None yet

5 participants

0