-
Notifications
You must be signed in to change notification settings - Fork 69
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
fix(floating-label): override inline transform during autofill #2079
Conversation
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.
Besides the fact that :has
doesn't have full support and the fix will not work on many browsers, the selectors look to need tweaking.
If we do use this solution, we should have an autofill example in Skin docs and storybook.
I realize this is somewhat of a user-specific thing that gets triggered on page usage, but it will help to confirm fixes and see breaks in the future by using a fairly common autocomplete="username"
attribute.
|
||
// Autofill | ||
|
||
label.floating-label__label:has(+ .textbox :autofill) { |
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.
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.
...or possibly, that transform is from a different selector and the :has
isn't getting applied at all?
transform: scale(0.75, 0.75) translate(0, 2px); | ||
} | ||
|
||
.floating-label--large label.floating-label__label:has(+ .textbox :autofill) { |
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.
Where are the before and after screenshots from? |
Thanks for the comments @ArtBlue, we talked offline and resolved all of the issues. As it turns out, for sufficiently large websites such as the |
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.
Looks good!
fix(floating-label): override inline transform during autofill (#2079)
Description
There are some edge cases that we can't currently handle without a major JavaScript refactor regarding floating labels, which are simple to fix with modern CSS. In this PR I provide a few selectors which will fix these issues on modern browsers, and preserve current behavior if the
:has
selector is not supported.I tested this using
npm link
fromebayui-core
'sfloating-label-autocomplete
branch. It may be worth it to add this as a test, but for now I think it is ok just to have up for testing purposes.Notes
@supports
group to handle browsers which did not support:has
, but ourless
bundler is outdated and it will not compile properly. Related to this issue, which was fixed in version10.2.5
ofautoprefixer
, butless-plugin-autoprefix
uses an older version and also breaks when I force it to use the newest.@supports
.transform
rules here are duplicated from above which I am not a fan of, butstylelint
won't let me group them together because of theno-descending-specificity
rule.Screenshots
Before:
After:
Checklist